public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/47394] New: Internal compiler error when error count limit is reached
@ 2011-01-21 12:46 thenlich at users dot sourceforge.net
  2011-01-21 13:42 ` [Bug fortran/47394] " burnus at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: thenlich at users dot sourceforge.net @ 2011-01-21 12:46 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: Internal compiler error when error count limit is
                    reached
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: thenlich@users.sourceforge.net


When compiling a program with -fmax-errors=n and the n-th error is encountered,
an internal compiler error occurs and the gfortran command exits with status 4.

Expected result is: the compiler should report the abortion and exit with the
status code according to the error encountered, like the C compiler does.

Example:
$ echo x > test.f
$ gfortran -fmax-errors=1 test.f
test.f:1.1:

x
 1
Error: Non-numeric character in statement label at (1)
Fatal Error: Error count reached limit of 1.
gfortran.exe: internal compiler error: Aborted (program f951)
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

$ echo $?
4


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

* [Bug fortran/47394] Internal compiler error when error count limit is reached
  2011-01-21 12:46 [Bug fortran/47394] New: Internal compiler error when error count limit is reached thenlich at users dot sourceforge.net
@ 2011-01-21 13:42 ` burnus at gcc dot gnu.org
  2011-01-21 21:45 ` burnus at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-01-21 13:42 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

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

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-01-21 13:17:55 UTC ---
This seems to be a Windows / MinGW specific problem caused by the way gfortran
returns when a fatal error occurs.

gfortran just calls
   exit(3);

which according to Kai matches Windows' abort status code.

The proper way seems to use the system.h's exit codes: FATAL_EXIT_CODE,
EXIT_SUCCESS and EXIT_FAILURE instead of hard-coded error codes.


The error message itself is printed by the driver (gcc.c, gfortran.exe) and not
by the proper compiler (f951.exe).


Draft patch:

diff --git a/gcc/fortran/error.c b/gcc/fortran/error.c
index 3092828..8520e2a 100644
--- a/gcc/fortran/error.c
+++ b/gcc/fortran/error.c
@@ -941,3 +941,3 @@ gfc_error_now (const char *gmsgid, ...)
   if (flag_fatal_errors)
-    exit (1);
+    exit (EXIT_FAILURE);
 }
@@ -958,3 +958,3 @@ gfc_fatal_error (const char *gmsgid, ...)

-  exit (3);
+  exit (FATAL_EXIT_CODE);
 }
@@ -1021,3 +1021,3 @@ gfc_error_check (void)
       if (flag_fatal_errors)
-       exit (1);
+       exit (EXIT_FAILURE);
     }
diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c
index c226bae..d4388e0 100644
--- a/gcc/fortran/scanner.c
+++ b/gcc/fortran/scanner.c
@@ -1870,3 +1870,3 @@ include_line (gfc_char_t *line)
   if (load_file (filename, NULL, false) == FAILURE)
-    exit (1);
+    exit (EXIT_FAILURE);

@@ -2074,3 +2074,3 @@ gfc_new_file (void)

-  exit (0);
+  exit (EXIT_SUCCESS);
 #endif


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

* [Bug fortran/47394] Internal compiler error when error count limit is reached
  2011-01-21 12:46 [Bug fortran/47394] New: Internal compiler error when error count limit is reached thenlich at users dot sourceforge.net
  2011-01-21 13:42 ` [Bug fortran/47394] " burnus at gcc dot gnu.org
@ 2011-01-21 21:45 ` burnus at gcc dot gnu.org
  2011-01-21 22:55 ` burnus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-01-21 21:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-01-21 20:33:15 UTC ---
Author: burnus
Date: Fri Jan 21 20:33:10 2011
New Revision: 169104

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=169104
Log:
2011-01-21  Tobias Burnus  <burnus@net-b.de>

        PR fortran/47394
        * error.c (gfc_error_now, gfc_fatal_error, gfc_error_check):
        Use defined instead of magic number exit status codes.
        * scanner.c (include_line, gfc_new_file): Ditto.


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


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

* [Bug fortran/47394] Internal compiler error when error count limit is reached
  2011-01-21 12:46 [Bug fortran/47394] New: Internal compiler error when error count limit is reached thenlich at users dot sourceforge.net
  2011-01-21 13:42 ` [Bug fortran/47394] " burnus at gcc dot gnu.org
  2011-01-21 21:45 ` burnus at gcc dot gnu.org
@ 2011-01-21 22:55 ` burnus at gcc dot gnu.org
  2011-01-21 22:56 ` burnus at gcc dot gnu.org
  2011-11-07 22:43 ` fxcoudert at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-01-21 22:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-01-21 22:38:58 UTC ---
Author: burnus
Date: Fri Jan 21 22:38:55 2011
New Revision: 169109

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=169109
Log:
2011-01-21  Tobias Burnus  <burnus@net-b.de>

        PR fortran/47394
        * error.c (gfc_error_now, gfc_fatal_error, gfc_error_check):
        Use defined instead of magic number exit status codes.
        * scanner.c (include_line, gfc_new_file): Ditto.
        * gfortranspec.c (lang_specific_driver): Ditto.


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


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

* [Bug fortran/47394] Internal compiler error when error count limit is reached
  2011-01-21 12:46 [Bug fortran/47394] New: Internal compiler error when error count limit is reached thenlich at users dot sourceforge.net
                   ` (2 preceding siblings ...)
  2011-01-21 22:55 ` burnus at gcc dot gnu.org
@ 2011-01-21 22:56 ` burnus at gcc dot gnu.org
  2011-11-07 22:43 ` fxcoudert at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-01-21 22:56 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-01-21 22:40:30 UTC ---
FIXED on the trunk (4.6) and on the 4.5 branch.

Thanks for the report!


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

* [Bug fortran/47394] Internal compiler error when error count limit is reached
  2011-01-21 12:46 [Bug fortran/47394] New: Internal compiler error when error count limit is reached thenlich at users dot sourceforge.net
                   ` (3 preceding siblings ...)
  2011-01-21 22:56 ` burnus at gcc dot gnu.org
@ 2011-11-07 22:43 ` fxcoudert at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2011-11-07 22:43 UTC (permalink / raw)
  To: gcc-bugs

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

Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pavel.belomestnov at
                   |                            |regeneron dot com

--- Comment #5 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> 2011-11-07 22:41:08 UTC ---
*** Bug 50231 has been marked as a duplicate of this bug. ***


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

end of thread, other threads:[~2011-11-07 22:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-21 12:46 [Bug fortran/47394] New: Internal compiler error when error count limit is reached thenlich at users dot sourceforge.net
2011-01-21 13:42 ` [Bug fortran/47394] " burnus at gcc dot gnu.org
2011-01-21 21:45 ` burnus at gcc dot gnu.org
2011-01-21 22:55 ` burnus at gcc dot gnu.org
2011-01-21 22:56 ` burnus at gcc dot gnu.org
2011-11-07 22:43 ` fxcoudert 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).