From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23154 invoked by alias); 19 Jan 2011 11:24:29 -0000 Received: (qmail 23145 invoked by uid 22791); 19 Jan 2011 11:24:28 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 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; Wed, 19 Jan 2011 11:24:23 +0000 From: "roger.ferrer at bsc dot es" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/47359] New: Recursive functions of intrinsic names generates invalid assembler 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: roger.ferrer at bsc dot es 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" MIME-Version: 1.0 Date: Wed, 19 Jan 2011 12:24:00 -0000 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: 2011-01/txt/msg01909.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47359 Summary: Recursive functions of intrinsic names generates invalid assembler Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned@gcc.gnu.org ReportedBy: roger.ferrer@bsc.es I know this is sort of a contrived case but seems that gfortran is getting confused in this case leading to syntactically invalid assembler. RECURSIVE FUNCTION MAX(A, B) RESULT(K) IF (B >= 0) THEN K = MAX(A+1, B-1) ELSE K = A END IF END $ gfortran -c test.f90 -save-temps test.s:11: Error: junk at end of line, first unrecognized character is `(' test.s:12: Error: unrecognized symbol type "" test.s:12: Error: junk at end of line, first unrecognized character is `(' test.s:13: Error: Unrecognized opcode: `__(intrinsic)__max:' test.s:73: Error: expected comma after name `__' in .size directive $ cat -n test.s ... 11 .globl __(intrinsic)__max 12 .type __(intrinsic)__max, @function 13 __(intrinsic)__max: ... 73 .size __(intrinsic)__max,.-__(intrinsic)__max My guess is that gfortran is picking the intrinsic 'max' function symbol instead of the one being currently defined (which is recursive and thus is eligible to be called in its same body, isn't it?) I don't know how much conformant this is to Fortran standard but Intel Fortran and IBM XL Fortran did not complain and successfully generated an object file. If this is not valid Fortran, an error message is better than a cryptic assembler syntax error :)