Issue Details (XML | Word | Printable)

Key: PCC-352
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Anders Magnusson
Reporter: Gregory McGarry
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
pcc

scan.l::cvtdig() assumes host and target system have same type sizes

Created: 27/May/11 06:34 AM   Updated: 06/Aug/12 07:57 PM
Component/s: None
Affects Version/s: None
Fix Version/s: None

Environment:
host: OS X i386
target: OS X amd64


 Description  « Hide
Essentially, this configuration is a cross compiler.

MAX_LONG is defined inside arch/amd64/macdefs.h for the target system, but is used in cvtdig() on the host system.

This can be seen with the following warnings:

{code}
gcc -DGCC_COMPAT -DPCC_DEBUG -Dos_darwin -Dmach_amd64 -D_ISOC99_SOURCE -I. -I. -I../.. -I../../mip -I../../arch/amd64 -I../../os/darwin -g -O2 -c -o scan.o scan.c
scan.l: In function 'cvtdig':
scan.l:506: warning: integer constant is too large for 'long' type
scan.l:517: warning: integer constant is too large for 'unsigned long' type
scan.l:519: warning: integer constant is too large for 'long' type
scan.l:531: warning: integer constant is too large for 'unsigned long' type
{code}

It's also seen here:

{code}
gcc -DGCC_COMPAT -DPCC_DEBUG -Dos_darwin -Dmach_amd64 -D_ISOC99_SOURCE -I. -I. -I../.. -I../../mip -I../../arch/amd64 -I../../os/darwin -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wsign-compare -c -o stabs.o stabs.c
stabs.c: In function 'stabs_init':
stabs.c:111: warning: integer constant is too large for 'long' type
stabs.c:111: warning: integer constant is too large for 'long' type
stabs.c:117: warning: integer constant is too large for 'unsigned long' type
{code}


 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Anders Magnusson made changes - 31/Jul/12 09:45 AM
Field Original Value New Value
Assignee Anders Magnusson [ ragge ]
Anders Magnusson added a comment - 31/Jul/12 09:45 AM
Is there a simple way to reproduce this?

Gregory McGarry added a comment - 01/Aug/12 02:56 AM
On a 32-bit machine, try to compile a 64-bit cross-compiler:

{code}
$ sh configure --target=x86_64--netbsd
{code}

Maybe it works the other way round too.

Anders Magnusson added a comment - 06/Aug/12 07:57 PM
Great, thanks, fixed now (at least for amd64). Large sizes must be the same as CONSZ

Anders Magnusson made changes - 06/Aug/12 07:57 PM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]