public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/46140] New: [4.4/4.5/4.6 Regression] Include not found - but exit status code is zero
@ 2010-10-22 20:16 burnus at gcc dot gnu.org
  2010-10-22 20:51 ` [Bug fortran/46140] " kargl at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: burnus at gcc dot gnu.org @ 2010-10-22 20:16 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46140

           Summary: [4.4/4.5/4.6 Regression] Include not found - but exit
                    status code is zero
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org


Reported by Thomas Jahns by email and at
  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=561245

Compiling the following program gives
  Error: Can't open included file 'notthere.inc'

However, using GCC 4.4, 4.5 and 4.6 the exit status code is zero:

$ gfortran-4.3 test.f90; echo $?
Error: Can't open included file 'notthere.inc'
1

$ gfortran-4.4 test.f90; echo $?
test.f90:2: Error: Can't open included file 'notthere.inc'
0


program testinc
  include 'notthere.inc'
  print *, 'I''m running although I shouldn''t even compile.'
end program


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/46140] [4.4/4.5/4.6 Regression] Include not found - but exit status code is zero
  2010-10-22 20:16 [Bug fortran/46140] New: [4.4/4.5/4.6 Regression] Include not found - but exit status code is zero burnus at gcc dot gnu.org
@ 2010-10-22 20:51 ` kargl at gcc dot gnu.org
  2010-10-22 21:20 ` burnus at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: kargl at gcc dot gnu.org @ 2010-10-22 20:51 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46140

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #1 from kargl at gcc dot gnu.org 2010-10-22 20:51:21 UTC ---
Someone named Tobias broke this with

troutmask:sgk[206] svn diff -r 141543:141544 | more

@@ -1791,7 +1802,8 @@ load_file (const char *realfilename, con
       input = gfc_open_included_file (realfilename, false, false);
       if (input == NULL)
        {
-         gfc_error_now ("Can't open included file '%s'", filename);
+         fprintf (stderr, "%s:%d: Error: Can't open included file '%s'\n",
+                  current_file->filename, current_file->line, filename);
          return FAILURE;
        }
     }

where the return value of load_file is never checked.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/46140] [4.4/4.5/4.6 Regression] Include not found - but exit status code is zero
  2010-10-22 20:16 [Bug fortran/46140] New: [4.4/4.5/4.6 Regression] Include not found - but exit status code is zero burnus at gcc dot gnu.org
  2010-10-22 20:51 ` [Bug fortran/46140] " kargl at gcc dot gnu.org
@ 2010-10-22 21:20 ` burnus at gcc dot gnu.org
  2010-10-22 21:42 ` kargl at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu.org @ 2010-10-22 21:20 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46140

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-10-22 21:20:16 UTC ---
(In reply to comment #1)
> Someone named Tobias broke this with

Which was part of the fix for PR 37821. The issue was that the file name of the
including file was not printed before.

I think there is another issue besides the missing exit status code: I think
the error message is always printed in English. I think one needs at least to
use _(...) or to use another mechanism.

Maybe one should try again to use gfc_error_now - but one needs somehow to make
the locus available - maybe by constructing one and passing it via %L? Or maybe
using a simple "at %C" works?


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/46140] [4.4/4.5/4.6 Regression] Include not found - but exit status code is zero
  2010-10-22 20:16 [Bug fortran/46140] New: [4.4/4.5/4.6 Regression] Include not found - but exit status code is zero burnus at gcc dot gnu.org
  2010-10-22 20:51 ` [Bug fortran/46140] " kargl at gcc dot gnu.org
  2010-10-22 21:20 ` burnus at gcc dot gnu.org
@ 2010-10-22 21:42 ` kargl at gcc dot gnu.org
  2010-10-22 22:49 ` sgk at troutmask dot apl.washington.edu
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: kargl at gcc dot gnu.org @ 2010-10-22 21:42 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46140

--- Comment #3 from kargl at gcc dot gnu.org 2010-10-22 21:42:33 UTC ---
A patch as simple as

Index: scanner.c
===================================================================
--- scanner.c   (revision 165861)
+++ scanner.c   (working copy)
@@ -1867,7 +1867,9 @@ include_line (gfc_char_t *line)
                   read by anything else.  */

   filename = gfc_widechar_to_char (begin, -1);
-  load_file (filename, NULL, false);
+  if (load_file (filename, NULL, false) == FAILURE)
+    exit (1);
+  
   gfc_free (filename);
   return true;
 }

gives an exit status

troutmask:sgk[205] gfc4x -o z t.f90
t.f90:2: Error: Can't open included file 'notthere.inc'
troutmask:sgk[206] gfc4x -o z t.f90 ; echo $?
t.f90:2: Error: Can't open included file 'notthere.inc'
1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/46140] [4.4/4.5/4.6 Regression] Include not found - but exit status code is zero
  2010-10-22 20:16 [Bug fortran/46140] New: [4.4/4.5/4.6 Regression] Include not found - but exit status code is zero burnus at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2010-10-22 21:42 ` kargl at gcc dot gnu.org
@ 2010-10-22 22:49 ` sgk at troutmask dot apl.washington.edu
  2010-10-23 11:34 ` burnus at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: sgk at troutmask dot apl.washington.edu @ 2010-10-22 22:49 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46140

--- Comment #4 from Steve Kargl <sgk at troutmask dot apl.washington.edu> 2010-10-22 22:48:54 UTC ---
On Fri, Oct 22, 2010 at 09:42:36PM +0000, kargl at gcc dot gnu.org wrote:
> 
> Index: scanner.c
> ===================================================================
> --- scanner.c   (revision 165861)
> +++ scanner.c   (working copy)
> @@ -1867,7 +1867,9 @@ include_line (gfc_char_t *line)
>                    read by anything else.  */
> 
>    filename = gfc_widechar_to_char (begin, -1);
> -  load_file (filename, NULL, false);
> +  if (load_file (filename, NULL, false) == FAILURE)
> +    exit (1);
> +  
>    gfc_free (filename);
>    return true;
>  }
> 

The above patch passes regression testing without
any new regressions.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/46140] [4.4/4.5/4.6 Regression] Include not found - but exit status code is zero
  2010-10-22 20:16 [Bug fortran/46140] New: [4.4/4.5/4.6 Regression] Include not found - but exit status code is zero burnus at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2010-10-22 22:49 ` sgk at troutmask dot apl.washington.edu
@ 2010-10-23 11:34 ` burnus at gcc dot gnu.org
  2010-10-24  0:29 ` kargl at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu.org @ 2010-10-23 11:34 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46140

--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-10-23 11:34:38 UTC ---
(In reply to comment #3)
> -  load_file (filename, NULL, false);
> +  if (load_file (filename, NULL, false) == FAILURE)
> +    exit (1);
> +  

(In reply to comment #4)
> The above patch passes regression testing without
> any new regressions.

The patch is OK for 4.4, 4.5 and the trunk/4.6.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/46140] [4.4/4.5/4.6 Regression] Include not found - but exit status code is zero
  2010-10-22 20:16 [Bug fortran/46140] New: [4.4/4.5/4.6 Regression] Include not found - but exit status code is zero burnus at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2010-10-23 11:34 ` burnus at gcc dot gnu.org
@ 2010-10-24  0:29 ` kargl at gcc dot gnu.org
  2010-10-25 16:08 ` kargl at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: kargl at gcc dot gnu.org @ 2010-10-24  0:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46140

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2010.10.24 00:28:56
     Ever Confirmed|0                           |1

--- Comment #6 from kargl at gcc dot gnu.org 2010-10-24 00:28:56 UTC ---
After I finish regression testing on 4.4 and 4.5, I'll 
commit the patch.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/46140] [4.4/4.5/4.6 Regression] Include not found - but exit status code is zero
  2010-10-22 20:16 [Bug fortran/46140] New: [4.4/4.5/4.6 Regression] Include not found - but exit status code is zero burnus at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2010-10-24  0:29 ` kargl at gcc dot gnu.org
@ 2010-10-25 16:08 ` kargl at gcc dot gnu.org
  2010-10-25 16:10 ` kargl at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: kargl at gcc dot gnu.org @ 2010-10-25 16:08 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46140

--- Comment #7 from kargl at gcc dot gnu.org 2010-10-25 16:07:37 UTC ---
Author: kargl
Date: Mon Oct 25 16:07:34 2010
New Revision: 165922

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=165922
Log:
2010-10-25  Steven G. Kargl  <kargl@gcc.gnu.org>

    PR fortran/46140
    * fortran/scanner.c (include_line): Check return value of load_file.

Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/scanner.c


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/46140] [4.4/4.5/4.6 Regression] Include not found - but exit status code is zero
  2010-10-22 20:16 [Bug fortran/46140] New: [4.4/4.5/4.6 Regression] Include not found - but exit status code is zero burnus at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2010-10-25 16:08 ` kargl at gcc dot gnu.org
@ 2010-10-25 16:10 ` kargl at gcc dot gnu.org
  2010-10-25 16:12 ` kargl at gcc dot gnu.org
  2010-10-25 16:16 ` kargl at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: kargl at gcc dot gnu.org @ 2010-10-25 16:10 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46140

--- Comment #8 from kargl at gcc dot gnu.org 2010-10-25 16:09:51 UTC ---
Author: kargl
Date: Mon Oct 25 16:09:47 2010
New Revision: 165923

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=165923
Log:
2010-10-25  Steven G. Kargl  <kargl@gcc.gnu.org>

    PR fortran/46140
    * fortran/scanner.c (include_line): Check return value of load_file.

Modified:
    branches/gcc-4_5-branch/gcc/fortran/ChangeLog
    branches/gcc-4_5-branch/gcc/fortran/scanner.c


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/46140] [4.4/4.5/4.6 Regression] Include not found - but exit status code is zero
  2010-10-22 20:16 [Bug fortran/46140] New: [4.4/4.5/4.6 Regression] Include not found - but exit status code is zero burnus at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2010-10-25 16:10 ` kargl at gcc dot gnu.org
@ 2010-10-25 16:12 ` kargl at gcc dot gnu.org
  2010-10-25 16:16 ` kargl at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: kargl at gcc dot gnu.org @ 2010-10-25 16:12 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46140

--- Comment #9 from kargl at gcc dot gnu.org 2010-10-25 16:12:05 UTC ---
Author: kargl
Date: Mon Oct 25 16:11:54 2010
New Revision: 165924

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=165924
Log:
2010-10-25  Steven G. Kargl  <kargl@gcc.gnu.org>

    PR fortran/46140
    * fortran/scanner.c (include_line): Check return value of load_file.

Modified:
    branches/gcc-4_4-branch/gcc/fortran/ChangeLog
    branches/gcc-4_4-branch/gcc/fortran/scanner.c


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/46140] [4.4/4.5/4.6 Regression] Include not found - but exit status code is zero
  2010-10-22 20:16 [Bug fortran/46140] New: [4.4/4.5/4.6 Regression] Include not found - but exit status code is zero burnus at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2010-10-25 16:12 ` kargl at gcc dot gnu.org
@ 2010-10-25 16:16 ` kargl at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: kargl at gcc dot gnu.org @ 2010-10-25 16:16 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46140

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.4.6

--- Comment #10 from kargl at gcc dot gnu.org 2010-10-25 16:15:52 UTC ---
Fixed on 4.4, 4.5, and trunk.
Closing.


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2010-10-25 16:16 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-22 20:16 [Bug fortran/46140] New: [4.4/4.5/4.6 Regression] Include not found - but exit status code is zero burnus at gcc dot gnu.org
2010-10-22 20:51 ` [Bug fortran/46140] " kargl at gcc dot gnu.org
2010-10-22 21:20 ` burnus at gcc dot gnu.org
2010-10-22 21:42 ` kargl at gcc dot gnu.org
2010-10-22 22:49 ` sgk at troutmask dot apl.washington.edu
2010-10-23 11:34 ` burnus at gcc dot gnu.org
2010-10-24  0:29 ` kargl at gcc dot gnu.org
2010-10-25 16:08 ` kargl at gcc dot gnu.org
2010-10-25 16:10 ` kargl at gcc dot gnu.org
2010-10-25 16:12 ` kargl at gcc dot gnu.org
2010-10-25 16:16 ` kargl at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).