bug-gnulib
[Top][All Lists]
Advanced

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

Re: [bug-gnulib] proposed patch to allocsa, vasnprintf for Tandem NSK (O


From: Paul Eggert
Subject: Re: [bug-gnulib] proposed patch to allocsa, vasnprintf for Tandem NSK (OSS)
Date: Wed, 11 Oct 2006 11:14:54 -0700
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

mwoehlke <address@hidden> writes:

  #error "Right shift of integers of type char does not work!!"
  #error "Casts from char to short works by zero-extend!!"
  #error "Casts from char to int works by zero-extend!!"
  #error "Casts from char to long works by zero-extend!!"
  #error "Casts from char to long long works by zero-extend!!"
  #error "Casts from char to unsigned short works by zero-extend!!"
  #error "Casts from char to unsigned int works by zero-extend!!"
  #error "Casts from char to unsigned long works by zero-extend!!"

I think these are due to a portability problem in the test program,
not a bug in your compiler.  The test program uses code like this:

   #ifdef __CHAR_UNSIGNED__
   typedef signed char  schar;
   #else
   typedef char  schar;
   #endif

but this assumes an GCC-like __CHAR_UNSIGNED__ macro.  If you
recompile with -D__CHAR_UNSIGNED__ those messages should go way.

> I'm attaching the non-optimized output. The optimized ('cc -O') output
> is identical, plus these two errors:
>
> #error "Left shift of integers of type long long does not work!!"

This error is more troublesome.  Can you debug the program to find out
exactly which values caused the problem?  You can insert printf
statements to see exactly which shift messed up.  Possibly it is a
compiler bug, which means you should not use -O.  But possibly it is
due to a portability problem in the test program.

> #error "Right shift of integers of type long long does not work!!"

I'd like this to be analyzed similarly.  Here, the test program
assumes that right shifts of a signed number propagate the sign, which
is not a portable assumption; possibly this is what's happening here,
which would mean it's not a compiler bug.  But still, it'd be good
to know exactly what is going on here.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]