Help on emitting static constant arrays

FX Coudert
Thu Jul 5 14:10:00 GMT 2007

Hi all,

I'm modifying the Fortran front-end to emit code such as:

   static int4 options.2[5] = {102, 127, 1, 1, 1};
   _gfortran_set_options (5, options.2);

where _gfortran_set_options is a library function with prototype  
"void _gfortran_set_options (int , int [])". This works well (the  
pseudo-code snippet above is in fact an extract of the optimized tree  
dump), but breaks when used with -O2 -funroll-loops: I get a segfault  
due to the function being called with (seen from gdb):

   *_gfortran_set_options (num=5, options=0x0)

It's probably a beginner mistake, but I never wrote code to emit  
GIMPLE arrays before, and don't know where to look exactly. I'll  
continue looking for the reason, but if someone thinks of something  
trivial I'd be interested in knowing!

Thanks for the help, and sorry (in advance) if it's a completely  
stupid mistake.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: try.diff
Type: application/octet-stream
Size: 5085 bytes
Desc: not available
URL: <>

More information about the Gcc mailing list