pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg/34113: pkgsrc/emulators/tme fix for gcc4



The following reply was made to PR pkg/34113; it has been noted by GNATS.

From: arthur <arthur%ilvsun3.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: pkg/34113: pkgsrc/emulators/tme fix for gcc4
Date: Sun, 04 Feb 2007 14:52:12 -0500

 Under NetBSD 3.1, i386, with GCC4, tme incorrectly performs the m68k 
 instruction: roxrl #1,d1.
 
 This was found by running the gcc-3.2.3 testsuite under SunOS 4.1.1 
 under TME and noting that ashrdi-1.c generated the same executable under 
 TME gcc-3.3.3 and TME gcc-4.1.1, but that the executable aborted when 
 running under gcc-4.1.1.
 
 The direct cause of the problem was that SHIFTMAX_INT32_T was defined in 
 config.h to 63 under gcc4 - which caused the tme_m68k_roxr32 routine to 
 emulate roxrl incorrectly.  Changing the config.h to that generated 
 under gcc-3.3.3 (with a SHIFTMAX_INT32_T of 31) allowed TME under 
 gcc-4.1.1. to work identically to TME under gcc-3.3.3.
 
 Izumi went one step further and noted that C specification says that 
 shift count larger than variable size causes "undefined" behavior, but 
 tme attempts to check how much count can be used on shift arithmetic for 
 each variable type.
 
 So that rather than have SHIFTMAX for byte, word, and longword all equal 
 to 31 (as generated under gcc-3.3.3), the shiftmax should never be 
 greater than the variable size.  Adding the following to 
 /usr/pkgsrc/emulators/tme/Makefile
 
 CONFIGURE_ARGS+=       ac_cv_shiftmax_int8_t=8
 CONFIGURE_ARGS+=       ac_cv_shiftmax_int16_t=16
 CONFIGURE_ARGS+=       ac_cv_shiftmax_int32_t=32
 
 right after
 CONFIGURE_ARGS+=       --disable-debug
 
 sets the SHIFTMAXes specifically to the maximum size allowed by the C 
 standard rather than having configure generate them dynamically.  TME 
 generated with gcc-3.3.3 and gcc-4.1.1 with this makefile also perform 
 identically on the gcc-3.2.3 SunOS testsuite as the original gcc-3.3.3 
 with 31 for all shiftmaxes.
 



Home | Main Index | Thread Index | Old Index