-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzilla
Description
| Bugzilla Link | 2271 |
| Resolution | FIXED |
| Resolved on | May 01, 2008 14:14 |
| Version | unspecified |
| OS | Linux |
| CC | @sunfishcode |
Extended Description
Assuming integer types are 2's complement, the attached code appears to have well-defined behavior. If I am misunderstanding something about C arithmetic then I apologize profusely for wasting peoples' time. The source should be small enough that someone can check this out relatively quickly.
With LLVM from recent svn on x86-32 I get the following:
[regehr@babel tmp1]$ llvm-gcc -O0 -fwrapv small.c ; ./a.out
foo
[regehr@babel tmp1]$ llvm-gcc -O1 -fwrapv small.c ; ./a.out
bar
For what it's worth "foo" is what gcc prints at all optimization levels.
Metadata
Metadata
Assignees
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzilla