Summary: | Promoting long to long long generates no warning and/or incorrect result. | ||
---|---|---|---|
Product: | gcc | Reporter: | Christian van den Bosch <cjb> |
Component: | c | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED INVALID | ||
Severity: | normal | CC: | gcc-bugs |
Priority: | P3 | ||
Version: | 3.3.4 | ||
Target Milestone: | --- | ||
Host: | i586-pc-linux-gnu | Target: | i586-pc-linux-gnu |
Build: | i586-pc-linux-gnu | Known to work: | |
Known to fail: | Last reconfirmed: | ||
Attachments: | Test case for 32-64 bit promotion bug |
Description
Christian van den Bosch
2005-11-24 15:15:53 UTC
Created attachment 10333 [details] Test case for 32-64 bit promotion bug Most recent version of this file available at http://cjb.ie/32-64bug.c or http://cjb.ie/32-64bug.c.txt a=1<<b; is done in the type of b and not of type of a so this is invalid as the behavior is undefined. Well, there's one actual issue here, namely that there is no warning about: int f() { int x = 40; return 1 << x; } even though we could of course detect this, albeit probably only in the middle-end. It might be difficult to get this warning to be emitted reliably and without false positives from there. (In reply to comment #2) > a=1<<b; > is done in the type of b and not of type of a The type of the right operand of a shift expression has no significance at all. 1 has type int, so has 1<<b. |