<< Back to previous view

[PCC-352] scan.l::cvtdig() assumes host and target system have same type sizes Created: 27/May/11  Updated: 06/Aug/12

Status: Resolved
Project: pcc
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Gregory McGarry Assignee: Anders Magnusson
Resolution: Fixed Votes: 0
Environment: host: OS X i386
target: OS X amd64


 Description   
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}


 Comments   
Comment by Anders Magnusson [ 31/Jul/12 09:45 AM ]
Is there a simple way to reproduce this?
Comment by Gregory McGarry [ 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.
Comment by Anders Magnusson [ 06/Aug/12 07:57 PM ]
Great, thanks, fixed now (at least for amd64). Large sizes must be the same as CONSZ
Generated at Fri Aug 22 05:57:00 CEST 2014 using JIRA Enterprise Edition, Version: 3.13.1-#333.