Bug 39576 - gcc/fortran/error.c's error.c missing "break"
Summary: gcc/fortran/error.c's error.c missing "break"
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: ---
Assignee: Francois-Xavier Coudert
URL:
Keywords: diagnostic, patch
Depends on:
Blocks:
 
Reported: 2009-03-29 09:30 UTC by Tobias Burnus
Modified: 2009-05-07 22:02 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-05-05 08:30:24


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2009-03-29 09:30:14 UTC
Sent to me in a private email - and not yet checked.
------------------------------------------------------------------

In gcc/fortran/error.c this statement

	  case 'u':
	    arg[pos].type = TYPE_UINTEGER;

looks like it's missing a 'break'. If a translator provided a format string
translation that contained the substring "%ulu", then an argument of type
TYPE_ULONGINT would be fetched and stored in arg[pos].u.ulongintval, and later,
spec[n++].u.uintval would be used. Which would lead to wrong results on 64-bit
platforms.
Comment 1 Paul Thomas 2009-04-07 09:23:55 UTC
from error.c(error_print)

00470           case 'u':
00471             arg[pos].type = TYPE_UINTEGER;
00472 
00473           case 'l':
00474             c = *format++;
00475             if (c == 'u')
00476               arg[pos].type = TYPE_ULONGINT;
00477             else if (c == 'i' || c == 'd')
00478               arg[pos].type = TYPE_LONGINT;
00479             else
00480               gcc_unreachable ();
00481             break;

....so, yes, without analysis I would say that the report is correct.

Confirmed.  I have given it the "wrong-code" keyword because it is likely to be true and to raise this out of the noise.

Paul 
Comment 2 Francois-Xavier Coudert 2009-05-05 08:30:24 UTC
I can confirm it's missing a break:

Index: error.c
===================================================================
--- error.c	(revision 147105)
+++ error.c	(working copy)
@@ -533,6 +533,7 @@
 
 	  case 'u':
 	    arg[pos].type = TYPE_UINTEGER;
+	    break;
 
 	  case 'l':
 	    c = *format++;
Comment 3 Francois-Xavier Coudert 2009-05-07 22:01:52 UTC
Subject: Bug 39576

Author: fxcoudert
Date: Thu May  7 22:01:34 2009
New Revision: 147257

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=147257
Log:
	PR fortran/39576
	* error.c (error_print): Add missing break statement.

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

Comment 4 Francois-Xavier Coudert 2009-05-07 22:02:03 UTC
Fixed.