First Last Prev Next    No search results available      Search page      Enter new bug
Bug#: 140987
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: Gentoo Science Related Packages <sci@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Joe Jezak <josejx@gentoo.org>
Add CC:
CC:
URL:
Summary:
Status Whiteboard:
Keywords:

Filename Description Type Creator Created Size Actions
hexcalc-order.diff Fixes the above issue. patch Joe Jezak 2006-07-18 18:06 0000 981 bytes Details | Diff
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 140987 depends on: Show dependency tree
Show dependency graph
Bug 140987 blocks:
Votes: 0    Show votes for this bug    Vote for this bug

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.






View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2006-07-18 18:01 0000
So, it builds fine with gcc-4.1.1, but if you compile with -O or
greater, some operations are broken, such as add and multiply.
Looking at the source, the broken operations all use PopArg() twice
in the same line.  PopArg() is actually replaced by
argStack[--argStackP] as a define.

So, this:
ac = PopArg() + PopArg();

Actually does:
ac = argStack[--argStackP] + argStack[--argStackP];

Which has undefined behaviour according to the gcc folks:
http://gcc.gnu.org/bugs.html#nonbugs

Basically, the --argStackP are done in a random order at best, which results in
broken results from the calculator.

I've attached a patch that fixes this broken code.  Thanks to lu_zero for
confirming it. :)

------- Comment #1 From Joe Jezak 2006-07-18 18:06:17 0000 -------
Created an attachment (id=92170) [edit]
Fixes the above issue.

------- Comment #2 From Joe Jezak 2006-07-25 11:08:45 0000 -------
I've committed this since it's a simple fix and the only ebuild in portage was
broken.  Hope you don't mind!  It should eventually go stable, but I'll leave
that up to the sci herd.

Thanks

First Last Prev Next    No search results available      Search page      Enter new bug