This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libgcc/78576] New: [PPC] wrong long double to long int conversion
- From: "brenohl at br dot ibm.com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 28 Nov 2016 23:07:06 +0000
- Subject: [Bug libgcc/78576] New: [PPC] wrong long double to long int conversion
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78576
Bug ID: 78576
Summary: [PPC] wrong long double to long int conversion
Product: gcc
Version: 6.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libgcc
Assignee: unassigned at gcc dot gnu.org
Reporter: brenohl at br dot ibm.com
Target Milestone: ---
On ppc64le environment, I am facing an wrong conversion between long double and
long int.
This is my test case, which prints 27 instead of 26.
#include<stdio.h>
#include<math.h>
int main (){
long double a = 3;
long double b = 3;
long c = powl(a,b);
printf("%d\n", c);
}
It does not seem to be a rounding issue, since fesetround() is not affecting
the result.
I also changed the optimization levels, and it is not affecting the result.