Bug 196323 - g++ gives line number out of range with -pedantic
Summary: g++ gives line number out of range with -pedantic
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: gcc3
Version: 4.0
Hardware: i686
OS: Linux
Target Milestone: ---
: ---
Assignee: Jakub Jelinek
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2006-06-22 15:41 UTC by Mark Nodine
Modified: 2007-11-30 22:07 UTC (History)
0 users

Clone Of:
Last Closed: 2006-06-22 16:00:46 UTC

Attachments (Terms of Use)

Description Mark Nodine 2006-06-22 15:41:42 UTC
Description of problem:

Version-Release number of selected component (if applicable):
g++ (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-52)

How reproducible:

Steps to Reproduce:
1.  Create a file bug.cpp with the following text:
#line 32768 "test.c"
#line 32767 "test.c"
2. g++ -o -pedantic -Werror test.cpp

Actual results:
bug.cpp:1:7: line number out of range
(plus no .o file is generated due to -Werror)

Expected results:
No error message and generate .o

Additional info:
Apparently g++ requires numbers in line directives to fit in a signed
16-bit number, since 32767 is OK but 32768 is not.

Comment 1 Mark Nodine 2006-06-22 15:43:04 UTC
Sorry.  Step 2 should have been

2. g++ -o -pedantic -Werror bug.cpp

Comment 2 Jakub Jelinek 2006-06-22 16:00:46 UTC
Please read the standard:
ISO/IEC 14882:1998
In [cpp.line]/3:
"If the digit sequence specifies zero or a number greater than 32767,
the behavior is undefined."

Note You need to log in before you can comment on or make changes to this bug.