Integer multiplication problem

Discussion about Parallella (and Epiphany) Software Development

Moderators: amylaar, jeremybennett, simoncook

Integer multiplication problem

Postby mikebell » Fri Jan 09, 2015 10:43 pm

I've just started experimenting with my new Parallella board, and had a play with the basic_math example in epiphany_examples/cpu

As a simple test to compare integer and floating point operations, I modified that test to do the basic math operations on integers instead of floats.

I then came across a weird problem where the result of the multiplication is wrong - I get 3 * 2 = 0! This only seems to happen when -O or higher is given to e-gcc. Looking at the assembler output nothing seems obviously wrong to my untrained eye.

The repro scenario goes away fairly easily when you start removing code from the example, but I've managed to cut it down a reasonable amount while preserving the bad behavior. Example project attached. If you edit build.sh to remove the -O then the test no longer fails.

Any clues as to what's going on here?
Attachments
mathtest.tgz
(2.9 KiB) Downloaded 1099 times
mikebell
 
Posts: 41
Joined: Thu Jan 08, 2015 9:46 pm

Return to Programming Q & A

Who is online

Users browsing this forum: No registered users and 17 guests

cron