http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52392
Bug #: 52392 Summary: internal compiler error occurs when compilin files separately but not when all is in one file Classification: Unclassified Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassig...@gcc.gnu.org ReportedBy: dominique.pellet...@polymtl.ca Created attachment 26758 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26758 contains the fortran files listed in the above bug report Greetings, I have encountered a very strange compiler bug with gfortran At least it is to me. I am using gfortran 4.6.1. I used the comman gffortran --version to get the information. I am developing a generic finite element program using object oriented FORTRAN 2003. Initially all sources were in one file and it worked well: gfortran has no probelms compiling the programs and its mosules. The results from executions are corrects. I then split the source to have one module per file plus a file for the main program. I compiled the individual modules in the proper sequence but gfortran generated an internal compiler error message for one of the modules. I got the following message from gfortran: [dp@C4079-13VM1 tests]$ gfortran -c testb_part1.f95 [dp@C4079-13VM1 tests]$ gfortran -c testb_part2.f95 testb_part2.f95: In function ‘link_wf_to_zones’: testb_part2.f95:66:0: internal compiler error: in fold_convert_loc, at fold-const.c:1906 Please submit a full bug report, with preprocessed source if appropriate. See <http://bugzilla.redhat.com/bugzilla> for instructions. I did my best to reproduce the bug on the simplest example possible. Enclosed are four files That i compiled on my Lenovo W520 running Linux Fedora 15, inside VMWare under Windows & enterprise 64 bit version. testa.f03 : it contains the source that compiles properly and executes correctly. I compiled it with gfortran testa.f03 -o testa.exe and executed it with ./testa.exe testb_part1.f03 and testb_part2.f03 : are obtained by splitting testa.f03 . I normaly compile them as follows: gfortran - c testb_part1.f03 gfortran - c testb_part2.f03 gfortran testb_part1.o testb_part2.o -o testb.exe and got the above internal compiler error message when compiling testb_part2.f03 testc.f03 : I merged the two files testb_part1.f03 and testb_part2.f03 to ensure that i had not introduced any changes when I split the original source file into two. I performed a diff on testa.f03 and testc.f03 to make sure that the two files are identical. I compiled with gfortran testc.f03 -o testc.exe and executed with ./testc.exe This yields results that are identical to those obtained with testa.f03 The problem seems to occur when I invoke the pointer-vallued function 'get_ptr_to_zone(zone_name), from the module zones_class. The argument 'zone_name' is a character(len=20) variable. and the function 'get_ptr_to zone' is of type 'zone_type'. Another very similar function 'get_zone_index' is identical to 'get_ptr_to_zone' except that it returns an index in a vector of type 'zone_type' instead of a pointer and that it causes no internal compiler error message. I thank you in advance for your attention. Please advise me as how best to proceed with this situation. Putting all modules in one source file seems to be a viable work-around for the short term. I expect that the Fortran 2003 source will grow quickly enough that keeping all modules in a single source file will become a hindrance in the near furure. Maybe it is possible to extend the viability of this approach by identifying which modules or parts of the source must be in the same source file to avoid the compiler bug ? Finally, I would like to know if my limited experience with fortran 2003, could be the root of my problem? Could I be trying things that are so twisted that gfortran gets into trouble? I thoroughly enjoy working with gfortran, and I hope that the bug that I am reporting is genuine and not a 'userproblem'. I look forward to your response . Sincerely, Dominique Pelletier Professor and Canada Research Chair Mechanical engineering department Ecole Polytechnique de Montreal dominique.pellet...@polymtl.ca