PR# 19551 C compilation error (without assertions with ec compiler)

Problem Report Summary
Submitter: phgachoud
Category: C Compilation
Priority: High
Date: 2019/07/05
Class: Bug
Severity: Critical
Number: 19551
Release: 19.05
Confidential: No
Status: Analyzed
Responsible:
Environment: linux Debian 9
Synopsis: C compilation error (without assertions with ec compiler)

Description
CF: https://groups.google.com/forum/#!topic/eiffel-users/4EjXwLGDzKQ


Compiling C code in C27
In file included from /opt/Eiffel_19.05/studio/spec/linux-x86-64/include/eif_globals.h:47:0,
                 from /opt/Eiffel_19.05/studio/spec/linux-x86-64/include/eif_eiffel.h:49,
                 from ar1512.c:5,
                 from big_file_C31_c.c:1:
me1527.c: In function â??F1080_7437â??:
me1527.c:338:30: error: â??typres0â?? undeclared (first use in this function)
   tr1 = RTLNSMART(RTCA(arg6, typres0).id);
                              ^
/opt/Eiffel_19.05/studio/spec/linux-x86-64/include/eif_macros.h:189:37: note: in definition of macro â??RTLNSMARTâ??
 #define RTLNSMART(x)  smart_emalloc(x)
                                     ^
me1527.c:338:19: note: in expansion of macro â??RTCAâ??
   tr1 = RTLNSMART(RTCA(arg6, typres0).id);
                   ^~~~
me1527.c:338:30: note: each undeclared identifier is reported only once for each function it appears in
   tr1 = RTLNSMART(RTCA(arg6, typres0).id);
                              ^
/opt/Eiffel_19.05/studio/spec/linux-x86-64/include/eif_macros.h:189:37: note: in definition of macro â??RTLNSMARTâ??
 #define RTLNSMART(x)  smart_emalloc(x)
                                     ^
me1527.c:338:19: note: in expansion of macro â??RTCAâ??
   tr1 = RTLNSMART(RTCA(arg6, typres0).id);
                   ^~~~
Makefile:35: recipe for target 'big_file_C31_c.o' failed
make[1]: *** [big_file_C31_c.o] Error 1
Makefile:158: recipe for target 'C31/Cobj31.o' failed
make: *** [C31/Cobj31.o] Error 2
make: *** Waiting for unfinishe
To Reproduce
with my project you can go into the eiffel directory and just do a make (The makefile will show you the options I give but are easy...)


Problem Report Interactions
From:alexk_es    Date:2019/07/09    Status: Analyzed    Download   
Thank you for the feedback. We were able to reproduce the other issue, and are looking for a fix.

The offending features are
- {DB_TABLE_DESCRIPTION}.attribute_list
- {DB_TABLE_DESCRIPTION}.printable_attribute_list
- {DB_TABLE_DESCRIPTION}.mapped_list

Until the bug is fixed, the following workarounds are possible:
- finalize without assertions turned on;
- comment out code of the features.

From:phgachoud    Date:2019/07/09    Status: Analyzed    Download   
Thx Alexander, actually I remember you mentioned me that the anchored types could not be used refering to arguments or "like Result" for a function but used it anyway spontaneously without thinking again that it wasn't possible. 

After modifying the code according to your advice, removing the EIFGEN's I still got the compilation error in both commandline compilation with '-keep' and estudio. 

Anything I misunderstood?

make[3]: Entering directory '/home/pg/data/solarity/sit-dev/eiffel/EIFGENs/ewf_app_standalone/F_code/C19'
make[3]: Leaving directory '/home/pg/data/solarity/sit-dev/eiffel/EIFGENs/ewf_app_standalone/F_code/C19'
Compiling C code in C18
make[3]: Entering directory '/home/pg/data/solarity/sit-dev/eiffel/EIFGENs/ewf_app_standalone/F_code/C18'
make[3]: Leaving directory '/home/pg/data/solarity/sit-dev/eiffel/EIFGENs/ewf_app_standalone/F_code/C18'
Compiling C code in C17
make[3]: Entering directory '/home/pg/data/solarity/sit-dev/eiffel/EIFGENs/ewf_app_standalone/F_code/C17'
make[3]: L
....
Output truncated, Click download to get the full message

Attachment: Screenshot_20190709_061958.png     Size:111134
From:alexk_es    Date:2019/07/09    Status: Analyzed    Download   
The error is caused by the creation instruction involving a type anchored to a feature argument. Such types are not part of Eiffel standard and are not supported by EiffelStudio except for some legacy code, not involving object creation. The offending feature is "items_from_date_time_interval_average" of the class MEASURE_UNIT_DB_SERVICE. Changing the type of the local variable "l_constraints" to "like {DB_REQUEST}.constraints" solves the issue.

We were able to see some other code generation anomalies, and will check if they are critical. Feel free to close the issue if the suggested modification resolves the problem.

From:phgachoud    Date:2019/07/05    Download   
Attachments for problem report #19551

Attachment: 20190702_dev_sit-dev.tgz     Size:6974690