Bug 196323

Summary: g++ gives line number out of range with -pedantic
Product: Red Hat Enterprise Linux 4 Reporter: Mark Nodine <mnodine>
Component: gcc3Assignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 4.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-06-22 16:00:46 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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:
Completely.

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."