Issue Details (XML | Word | Printable)

Key: PCC-470
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Anders Magnusson
Reporter: Volkmar Klatt
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.

programs (not pcc!) with float _Complex may crash or calculate wrong

Created: 14/Aug/14 02:22 PM   Updated: 15/Sep/14 05:43 PM
Component/s: None
Affects Version/s: None
Fix Version/s: None

File Attachments: 1. Text File tr_20140813_74.c (0.3 kB)

Environment: 1.1.0.DEVEL 20140809 for i686-pc-linux-gnu

 Description  « Hide
/* multiplying complex floats may crash the program or give wrong results */

#include <stdio.h>
#include <complex.h>

int main()
   float _Complex x;
   x = (3.0f+2.0f*I) * (0.0f+1.0f*I);
   printf("x: % +#f% +#fi\n", crealf(x), cimagf(x));

   return 0;

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Anders Magnusson added a comment - 17/Aug/14 05:53 PM
Not on linux, but netbsd (should be the same):

nbi386:/home/ragge >pcc x.c pcc-libs/libpcc/libpcc.a
nbi386:/home/ragge >./a.out
x: -2.000000+3.000000i

The same result on Linux amd64...? Huh?

Anders Magnusson added a comment - 13/Sep/14 09:55 AM
Can I get an example of how it crashes? "Works for me" :-)

Anders Magnusson added a comment - 15/Sep/14 05:43 PM
Now fixed in another issue.