if() going wrong way on (-2)^31, sometimes. UTDScalarI.sac
|
|
Bugzilla Link |
906 |
Created on |
Jan 19, 2012 17:20 |
Version |
svn |
OS |
Linux |
Architecture |
PC |
Attachments |
crud3.sac, xcrud3.sac
|
Extended Description
Created an attachment (id=843)
source code to reproduce failure
The attached code is extracted from a failed apex unit test,
UTDScalarI.sac.
Depending on how (-2)^31 is generated, conditionals are
either true or false. This produces wrong answers, which
is not a good thing, IMO.
If you compile with -noinl, the answers change.
If you compile with -nocf, it crashes, this way:
**** Optimization cycle pass: 2
****** Optimizing regular function:
****** _MAIN::main( hidden(1), hidden(2), hidden(0)): ...
Applying common subexpression elimination ...
Inferring loop invariant variables ...
Applying type upgrade ...
ERROR: line 10 file: crud3.sac
ERROR: loop variable "_flat_28" is being used inconsistently in function
ERROR: _dup_262_mpyXII__Cond_2; conflicting types are bool{1} and #1352: in
ERROR: [ --, bool{0}] le <> ge <>
*** Compilation failed ***
*** Exit code 89 (Running SAC optimizations)
*** 1 Error(s), 0 Warning(s)
apex@rattler:~/apex2003/benchmks/UTDScalarI$ sac2c -V
sac2c v1.00-beta (Haggis And Apple)
developer rev 17723 linux-gnu_x86_64
(Fri Jan 13 16:39:25 EST 2012 by sac)
apex@rattler:~/apex2003/benchmks/UTDScalarI$ sac2c crud3.sac -v1 -nocf -nosaacyc -noive -v4