PR# 18349 Fixing a code generation issue with exception and onces

Problem Report Summary
Submitter: manus_eiffel
Category: Compiler
Priority: Medium
Date: 2012/10/06
Class: Bug
Severity: Serious
Number: 18349
Release: 7.2
Confidential: No
Status: Open
Responsible:
Environment: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.79 Safari/537.4
Synopsis: Fixing a code generation issue with exception and onces

Description
Just noticing that our code generation for once might be incorrect. Can you confirm that we generate the code as if there was a rescue clause? If it is indeed the case, then our code generation is omitting something important, before the routine is generated we need to generate

#undef EIF_VOLATILE
#define EIF_VOLATILE volatile

and at the end 

#undef EIF_VOLATILE
#define EIF_VOLATILE

You can see this in STD_BYTE_CODE.generate at line 413 and 597. However this is not the full story since doing that is not enough because we are still using RTLD when really we should be using RTXD in this case, but RTXD is not a replacement for RTLD, I see that in RTO_TRY we call RTYD but this is too late and it actually causes a runtime error when an exception occurs (eweasel test#exec336 and
test#once017 are showing that bug).

Here is the warning you get if you add -Wclobbered. Luckily this is not too critical since we try not to raise any exceptions in a once, but it certainly shows an oversight on our part:

> gcc -O3 -march=native -funroll-loops -Wall -pipe -fPIC -D_GNU_SOURCE 
> -m64
-DEIF_IEEE_BEHAVIOR -I"/home/manus/local/Eiffel5/studio/spec/linux-x86-64/include"
-I. -c big_file_C1_c.c -Wno-unused-function -Wno-unused-variable -Wclobbered In file included from big_file_C1_c.c:4:0:
is39.c: In function 'F33_801_body':
is39.c:792:2: warning: variable 'ol' might be clobbered by 'longjmp' or 'vfork'
[-Wclobbered]
is39.c: In function 'F33_800_body':
is39.c:750:2: warning: variable 'ol' might be clobbered by 'longjmp' or 'vfork'
[-Wclobbered]
is39.c: In function 'F33_799_body':
is39.c:709:2: warning: variable 'ol' might be clobbered by 'longjmp' or 'vfork'
[-Wclobbered]
is39.c: In function 'F33_795_body':
is39.c:542:2: warning: variable 'ol' might be clobbered by 'longjmp' or 'vfork'
[-Wclobbered]
is39.c: In function 'F33_797_body':
is39.c:632:2: warning: variable 'ol' might be clobbered by 'longjmp' or 'vfork'
[-Wclobbered]
is39.c: In function 'F33_796_body':
is39.c:584:2: warning: variable 'ol' might be clobbered by 'longjmp' or 'vfork'
[-Wclobbered]

Manu
To Reproduce

										
Problem Report Interactions