Bug 29864 - Folding conversion unsigned long long to float
Summary: Folding conversion unsigned long long to float
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2006-11-16 08:19 UTC by Erwin Unruh
Modified: 2008-02-04 15:52 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-11-16 09:54:40


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Erwin Unruh 2006-11-16 08:19:26 UTC
In Funktion expand_float the libcall generated for a conversion from unsigned long long to float gets a wrong EQUIV note. See line optabs.c:4712 in the 4.3-20061111 snapshot. The equiv note is set to gen_rtx_FLOAT regardless of the unsignedp flag. When that flag is set, it should be a gen_rtx_UNSIGNED_FLOAT note.
The error is also present in 4.2. In 4.1 it was hidden because the code was only executed with unsignedp being false.
I found the problem while working on a private port. I do not have a confirmed testcase for a public port. The problem surfaced when GCSE eliminated the libcall using the note for the conversion.
Comment 1 Richard Biener 2006-11-16 09:54:40 UTC
Confirmed.
Comment 2 Richard Biener 2008-02-04 15:52:59 UTC
A testcase would probably be sth along the lines of

extern void abort (void);
void __attribute__((noinline)) foo (unsigned long long x)
{
  float uf = x;
  float sf = (signed long long)x;
  if (uf == sf)
    abort ();
}
int main()
{
  foo (-1);
  return 0;
}

with the right target and soft-float (any suggestion?).