[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Parallella Community • View topic - Think I found a bug in the compiler for Epiphany

Think I found a bug in the compiler for Epiphany

Forum for anything not suitable for the other forums.

Think I found a bug in the compiler for Epiphany

Postby capnrob97 » Fri Jul 24, 2015 4:15 pm

Example

float f = -0.73; // Not this simple, see post below

int d = (int) f;

Looks like d = -1 on the epiphany when it should be 0

(int) should round towards 0, it is behaving like floor() it looks like.
Last edited by capnrob97 on Fri Jul 24, 2015 4:36 pm, edited 1 time in total.
capnrob97
 
Posts: 74
Joined: Fri Feb 01, 2013 1:11 pm

Re: Think I found a bug in the compiler for Epiphany

Postby capnrob97 » Fri Jul 24, 2015 4:33 pm

Not quite this simple.

When I pass a float back to the ArM processor in a memory address, I get -0.737241

If I cast that same float variable holding the negative float to an int and pass the int back via a memory address, the ARM shows -1

Similar code running on my Mac has 0 after running the same calcs and that cast, so not sure if the e_read() is to blame, or somewhere else on the epiphany side.

If I hard code a float on the epiphany to -0.737241, and cast to an int and pass it back to arm (arm does an e_read()) I get 0

If I pass that float back to the arm I get -0.737241

If I cast the float variable that passes back -0.737241 to an int and pass back the int, I get -1

Not sure where in the chain something is getting screwed up
capnrob97
 
Posts: 74
Joined: Fri Feb 01, 2013 1:11 pm

Re: Think I found a bug in the compiler for Epiphany

Postby aolofsson » Fri Jul 24, 2015 5:02 pm

User avatar
aolofsson
 
Posts: 1005
Joined: Tue Dec 11, 2012 6:59 pm
Location: Lexington, Massachusetts,USA

Re: Think I found a bug in the compiler for Epiphany

Postby capnrob97 » Fri Jul 24, 2015 5:16 pm

capnrob97
 
Posts: 74
Joined: Fri Feb 01, 2013 1:11 pm

Re: Think I found a bug in the compiler for Epiphany

Postby aolofsson » Fri Jul 24, 2015 5:27 pm

Posting a code snippet would be helpful. Not able to reproduce it with any compiler flags on the e-run functional simulator.
(Either there is a mismatch between simulator/hardware or there is something else going on.)
Andreas
User avatar
aolofsson
 
Posts: 1005
Joined: Tue Dec 11, 2012 6:59 pm
Location: Lexington, Massachusetts,USA

Re: Think I found a bug in the compiler for Epiphany

Postby capnrob97 » Fri Jul 24, 2015 5:43 pm

I will send it in a little while, work crisis just erupted
capnrob97
 
Posts: 74
Joined: Fri Feb 01, 2013 1:11 pm

Re: Think I found a bug in the compiler for Epiphany

Postby capnrob97 » Fri Jul 24, 2015 6:23 pm

Just send a tar gzipped file of the code to andreas at adapteva account.

Probably easier for you to compile it that posting code snippets

You will see I am returning the float var and the (int) var back to the ARM, arm is getting -1
capnrob97
 
Posts: 74
Joined: Fri Feb 01, 2013 1:11 pm

Re: Think I found a bug in the compiler for Epiphany

Postby capnrob97 » Fri Jul 24, 2015 11:29 pm

This is where I am returning the float and (int) float

s1 = series (1, pos);
s2 = series (4, pos);
s3 = series (5, pos);
s4 = series (6, pos);
pid = 4.0 * s1 - 2.0 * s2 - s3 - s4;
(*(f)) = pid;
(*(d)) = (int) pid;

When this code prints them out

e_read(&dev, row, col, 0x2000, &d, sizeof(int));
e_read(&dev, row, col, 0x3000, &f, sizeof(float));

printf ("%.8s - %d - %f\n", c, d, f);
fflush(stdout);
I get 00000000 - -1 - -0.737241

Hopefully not just a stupid byte alignement thing I am missing, but I don't think so.

If I add 2.0 to pid before returning the float and the int, I get the expected results

00000000 - 1 - 1.262759
capnrob97
 
Posts: 74
Joined: Fri Feb 01, 2013 1:11 pm

Re: Think I found a bug in the compiler for Epiphany

Postby capnrob97 » Sat Jul 25, 2015 6:00 pm

I put some code in for now to get past this.

Until I create a very stripped down program that recreates this with nothing else going on in the code, I am going to assume something in my code going on triggering this.

After I get my program functioning completely the way I want, I will circle around and try to create a simple program that does this issue.
capnrob97
 
Posts: 74
Joined: Fri Feb 01, 2013 1:11 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 5 guests

cron