This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] gcc/toplev.{c,h} + PR fortran/{40569,40568} compiler_options() + fixes


Daniel Kraft wrote:
Tobias Burnus wrote:
The patch was build and loosely tested. It is currently bootstrapping and will then be regtested on x86-64-linux. OK for the trunk?

ok for the Fortran part

Thanks for the review! Ian had already approved the toplev.* part; I followed his suggestion of adding a comment before gfc_get_option_string.


Comitted as Rev. 164698.


- add_sym_0 ("compiler_options", GFC_ISYM_COMPILER_OPTIONS, CLASS_IMPURE,
+ add_sym_0 ("compiler_options", GFC_ISYM_COMPILER_OPTIONS, CLASS_INQUIRY,


When you first submitted the patch with CLASS_IMPURE, I wondered about this -- but now I guess this was just in accident and the standard lists them as inquiry?

Yes that was on one hand a copy and paste mistake and also another misconception of mine. The standard lists them as inquiry functions in the module section as "speci cation inquiry" thus they are full "inquiry" citizens.


What about adding the if as default clause to the switch instead of the continue branching?
Done.

 gfc_simplify_compiler_version (void)
 {
+  buffer = (char*) alloca (len);
   return gfc_get_character_expr (gfc_default_character_kind,
+ &gfc_current_locus, buffer, len);

Possibly stupid question: Isn't alloca supposed to allocate memory on the stack that is free'ed automatically on scope exit? If so, doesn't this create a dangling pointer referenced from the expression?

For gfc_get_option_string I cannot use alloca as I return the string - thus it is explicitly freed in gfc_simplify_options. For the version string, it only needs to survive until gfc_get_character_expr - which then copies the string using gfc_char_to_widechar.


Tobias


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]