|
From: | mwoehlke |
Subject: | Re: proposed patch to allocsa, vasnprintf for Tandem NSK (OSS) |
Date: | Wed, 11 Oct 2006 14:53:06 -0500 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20060909 Thunderbird/1.5.0.7 Mnenhy/0.7.4.0 |
Paul Eggert wrote:
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.
Yes, defining __CHAR_UNSIGNED__ fixed it; no more errors on non-optimized.
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.
Ok, I did this: { right_works = FALSE; \ printf("j=%i\n", j);\ printf("shc=%i\n", shc);\ printf("sample1=%Ld\n", sample1);\ printf("sample2=%Ld\n", sample2);\ } \ ...and got this: j=1 shc=1 sample1=a84e715a515523b4 sample2=0 ...plus a huge number of others.If I am reading the code right, sample2 should have been 542738ad0x28aa91da, but even the 'pass' tests (and even those without -O) don't seem to jive with what I think I should be seeing based on my reading of the code. Sorry, but maybe you can walk me through what this *should* look like?
At any rate, FWIW every single trial fails at some point. -- Matthew Will your shell have salvation? Only if it's Bourne Again.
[Prev in Thread] | Current Thread | [Next in Thread] |