Subject: Re: toolchain/34549
To: None <toolchain-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Valeriy E. Ushakov <uwe@ptc.spbu.ru>
List: netbsd-bugs
Date: 12/01/2006 14:30:02
The following reply was made to PR toolchain/34549; it has been noted by GNATS.

From: "Valeriy E. Ushakov" <uwe@ptc.spbu.ru>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: toolchain/34549
Date: Fri, 1 Dec 2006 17:27:24 +0300

 Izumi Tsutsui provided the following analysis:
 
 > uwe@ptc.spbu.ru wrote:
 > 
 > > On Fri, Dec 01, 2006 at 00:59:30 +0900, Izumi Tsutsui wrote:
 > >
 > > > The statements in insn-emit.c are generated by
 > > > the following line:
 > > > >   printf (HOST_WIDE_INT_PRINT_DEC_C, INTVAL (x));
 > > > in src/gnu/dist/gcc4/gcc/genemit.c, and HOST_WIDE_INT_PRINT_DEC_C
 > > > is defined in src/gnu/dist/gcc4/gcc/hwint.h.
 > > >
 > > > It seems a macro for target type should be used there
 > > > (at least for insn-emit.c), but I have not tracked it yet.
 > >
 > > No, we are compiling on amd64 (build) a compiler that will run on sh3
 > > (host) and that compiler will produce code for sh3 (target), so HOST
 > > is correct.
 > >
 > > The question is why this HOST macro is defined incorrectly.
 > 
 > I think they are defined properly, but usage is wrong.
 > 
 > Sources for the "build" machine should include "bconfig.h"
 > then HOST_foo macros will represent build's sizes.
 > Sources for the "host" machine should include "config.h"
 > then HOST_foo macros will represent host's sizes.
 > 
 > But in genemit.c case, it's a source for the build so
 > it includes "bconfig.h" then HOST_foo macros represent
 > build's size, but HOST_WIDE_INT_PRINT_DEC_C is used
 > in printf(3) to create insn-emit.c which is a source
 > of the host machine.
 > Then a build's type (long) is used in a host's source
 > where it should be a host's type (long long).
 > 
 > Is there any way to refer host's sizes ("LL" suffix
 > for 64bit integers in this case) in build's sources?
 
 -uwe