🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #54305

enum's

#54305
From: mmodrall%greystone
Date: Wed, 05 Dec 1990 19:54
71 lines
3282 bytes
Hi...
	We're working with gcc 1.37.1 on a concurrent 5400, using
gas 1.37 as the underlying assembler.  We've changed nothing from
the configuration as we got it.

	We're having a small problem with enum types and casting
and gcc.  Here's my sample program to illustrate the problem.
An explanation of what happens is at the end.

test.c
-------
#include "test.h"

min(p)
char *p;
{
	unsigned char x;

	x = (unsigned char)test130;
	x = ((enum test)*p > test127);
	x = ((enum test)*p > test128);
	x = ((enum test)*p > test140);
	x = ((enum test)*p > test149);
}

test.h
--------
enum test
{
test1 = 1, test2, test3, test4, test5, test6,
test7, test8, test9, test10, test11, test12,
test13, test14, test15, test16, test17, test18,
test19, test20, test21, test22, test23, test24,
test25, test26, test27, test28, test29, test30,
test31, test32, test33, test34, test35, test36,
test37, test38, test39, test40, test41, test42,
test43, test44, test45, test46, test47, test48,
test49, test50, test51, test52, test53, test54,
test55, test56, test57, test58, test59, test60,
test61, test62, test63, test64, test65, test66,
test67, test68, test69, test70, test71, test72,
test73, test74, test75, test76, test77, test78,
test79, test80, test81, test82, test83, test84,
test85, test86, test87, test88, test89, test90,
test91, test92, test93, test94, test95, test96,
test97, test98, test99, test100, test101, test102,
test103, test104, test105, test106, test107, test108,
test109, test110, test111, test112, test113, test114, test115,
test116, test117, test118, test119, test120, test121,
test122, test123, test124, test125, test126, test127,
test128, test129, test130, test131, test132, test133,
test134, test135, test136, test137, test138, test139,
test140, test141, test142, test143, test144, test145,
test146, test147, test148, test149, test150}; 

	When compiled with gcc, test.c gets a warning
that the comparisons on test128, test140, and test149, saying
that the range is outside the datatype.  When compiled with
-traditional, it gives no warnings at all, and merely substitutes
127 for all of the comparison values. 

	thanks for taking a look

-mark

ps  i don't know if you remember, but i wrote you a while back saying
that i couldn't rebuild gcc with gcc if i changed the configuration to
pack structures.  I think that is because the structures used by library
calls in RTU are laid out unevenly.  All of the library routines were
compiled with a compiler that padded the structures, so routines compiled
with a structure-packing compiler can't talk to them anymore...
Technical Details
Message-ID: <9012051955.AA02263@uunet.UU.NET>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!peregrine!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!wuarchive!cs.utexas.edu!tut.cis.ohio-state.edu!UUNET.UU.NET!mmodrall%greystone

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,d38054d015cac975,start
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1990-12-06 05:32:38 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!peregrine!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!wuarchive!cs.utexas.edu!tut.cis.ohio-state.edu!UUNET.UU.NET!mmodrall%greystone
From: mmodrall%greystone@UUNET.UU.NET
Newsgroups: gnu.gcc.help
Subject: enum's
Message-ID: <9012051955.AA02263@uunet.UU.NET>
Date: 5 Dec 90 19:54:41 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 71
Posted: Wed Dec  5 20:54:41 1990