This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PATCH: problem for 16 bit 'int' types.


At 11:01 -0800 1/9/01, Richard Henderson wrote:

>On Tue, Jan 09, 2001 at 09:36:15AM -0500, lehotsky@tiac.net wrote:
>>  -       return b>=0x80000001;
>>  +       return b>= (INT_MIN+1);
>[...]
>>  -       return b>=0xffffffff;
>>  +       return b>=-1;
>
>Not ok.  You've changed the nature of the test.
>
>These two hex constants are of type "unsigned int" with a
>32-bit int in C89, and either "long" or "unsigned long" in
>C99 (depending on the width of the target's long).
>
>Using ((unsigned)INT_MAX + 2) and UINT_MAX should be ok.
>

	Thanks for catching that.  I actually looked to see what the C89 
standard said
	but misread the specifics.  I made the suggested modification and 
recompiled
	the test on Solaris to confirm that it still passes.  Amusingly enough
	it now fails on my port in 5 of the 6 executable versions - so it 
was a good
	catch!


>
>r~

-- 
------------------------------------------------------------------------

		    Quality Software Management
		http://www.tiac.net/users/qsmgmt
			apl@alum.mit.edu
			(978)287-0435 Voice
			(978)808-6836 Cell
			(978)287-0436 Fax

	Software Process Improvement and Management Consulting
	     Language Design and Compiler Implementation

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]