Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!amdcad!ames!rutgers!mtune!codas!killer!pollux!bobkat!m5 From: m5@bobkat.UUCP (Mike McNally ) Newsgroups: comp.lang.c Subject: C compiler problems Message-ID: <3372@bobkat.UUCP> Date: 2 Feb 88 17:25:10 GMT Reply-To: m5@bobkat.UUCP (Mike McNally (Man from Mars)) Distribution: na Organization: Digital Lynx, Inc; Dallas, TX Lines: 19 Summary: unsigned long constant folding is screwed up Here's a good one I came across this morning. Here's an expression: register unsigned long i; i = ((unsigned long) 0xffffffff / 10); Guess what the variable ``i'' is set to? Zero! The compiler just generates a CLRL instruction. Obviously the constant folding code does not include a special case for ``unsigned long''. The bug is present in our in-house compiler, in GNU CC, and in the Integrated Solutions 4.2 UNIX compiler. Green Hills generates correct code. -- Mike McNally, mercifully employed at Digital Lynx --- Where Plano Road the Mighty Flood of Forest Lane doth meet, And Garland fair, whose perfumed air flows soft about my feet... uucp: {texsun,killer,infotel}!pollux!bobkat!m5 (214) 238-7474