This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/36613] [4.1/4.2/4.3/4.4 Regression] likely codegen bug
- From: "jakub at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Jun 2008 12:00:39 -0000
- Subject: [Bug target/36613] [4.1/4.2/4.3/4.4 Regression] likely codegen bug
- References: <bug-36613-12544@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #6 from jakub at gcc dot gnu dot org 2008-06-25 12:00 -------
Simplified testcase (fails at -Os -m32):
/* PR target/36613 */
extern void abort (void);
static inline int
lshifts (int val, int cnt)
{
if (val < 0)
return val;
return val << cnt;
}
static inline unsigned int
lshiftu (unsigned int val, unsigned int cnt)
{
if (cnt >= sizeof (unsigned int) * __CHAR_BIT__
|| val > ((__INT_MAX__ * 2U) >> cnt))
return val;
return val << cnt;
}
static inline int
rshifts (int val, unsigned int cnt)
{
if (val < 0 || cnt >= sizeof (int) * __CHAR_BIT__)
return val;
return val >> cnt;
}
int
foo (unsigned int val)
{
return rshifts (1 + val, lshifts (lshiftu (val, val), 1));
}
int
main (void)
{
if (foo (1) != 0)
abort ();
return 0;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36613