From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16688 invoked by alias); 26 Feb 2012 23:29:45 -0000 Received: (qmail 16680 invoked by uid 22791); 26 Feb 2012 23:29:44 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,SARE_LWSHORTT,SARE_OBFU_VALUE,TW_GF X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 26 Feb 2012 23:29:31 +0000 From: "dominique.pelletier at polymtl dot ca" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/52392] New: internal compiler error occurs when compilin files separately but not when all is in one file Date: Sun, 26 Feb 2012 23:31:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dominique.pelletier at polymtl dot ca X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-02/txt/msg02505.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D52392 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: unassigned@gcc.gnu.org ReportedBy: dominique.pelletier@polymtl.ca Created attachment 26758 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=3D26758 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.=20 I then split the source to have one module per file plus=20 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.=20 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 =E2=80=98link_wf_to_zones=E2=80=99: 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 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=20 function 'get_ptr_to_zone(zone_name), from the module zones_class. The argument 'zone_name' is a character(len=3D20) 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=20 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=20 extend the viability of this approach by identifying which modules or parts of the source must be in the same source file to avoid=20 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=20 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.Pelletier@polymtl.ca