public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/46399] New: Missing type promotion for library call argument
@ 2010-11-09 17:09 krebbel at gcc dot gnu.org
  2010-11-09 17:10 ` [Bug middle-end/46399] " krebbel at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: krebbel at gcc dot gnu.org @ 2010-11-09 17:09 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46399

           Summary: Missing type promotion for library call argument
           Product: gcc
           Version: 4.4.3
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: krebbel@gcc.gnu.org


The following testcase produces an unexpected result when compiled with:
gcc -O3 t.c -ot

int
main ()
{
  volatile _Decimal32 b, c;
  volatile unsigned int ui;
  volatile long long sll;

  ui = 1;
  sll = 1LL;
  b = sll;
  c = ui;

  printf("b: %x\n", *(int*)&b);
  printf("c: %x\n", *(int*)&c);
}

./t:
b: 22500001
c: 3a95e225

The problem appears to be a missing type promotion when doing the conversion
from unsigned int to _Decimal32 in c = ui:

        stmg    %r14,%r15,112(%r15)
        aghi    %r15,-184
        lhi     %r1,1
        st      %r1,180(%r15)
        lghi    %r1,1
        stg     %r1,160(%r15)
        lg      %r2,160(%r15)           <-- load a 64bit value into r2
        brasl   %r14,__dpd_floatdisd
        ste     %f0,172(%r15)
        l       %r2,180(%r15)           <-- load a 32bit value into r2
        brasl   %r14,__dpd_floatunssisd     without zero extending to 64bit
        ....

When I manually kill the upper 32 bits of r2 before doing the second lib call
it works fine:

        stmg    %r14,%r15,112(%r15)
        aghi    %r15,-184
        .cfi_offset 15, -40
        .cfi_offset 14, -48
        .cfi_def_cfa_offset 344
        lhi     %r1,1
        st      %r1,180(%r15)
        lghi    %r1,1
        stg     %r1,160(%r15)
        lg      %r2,160(%r15)
        brasl   %r14,__dpd_floatdisd
        ste     %f0,172(%r15)
        lghi    %r2,0                    <-- load a 64bit 0 into r2
        l       %r2,180(%r15)
        brasl   %r14,__dpd_floatunssisd
        ...

The result then is:
b: 22500001
c: 22500001


The testcase above is extracted from gcc.dg/dfp/pr41049.c which currently seems
to fail due to that problem on s390*.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/46399] Missing type promotion for library call argument
  2010-11-09 17:09 [Bug middle-end/46399] New: Missing type promotion for library call argument krebbel at gcc dot gnu.org
@ 2010-11-09 17:10 ` krebbel at gcc dot gnu.org
  2011-05-09  8:56 ` krebbel at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: krebbel at gcc dot gnu.org @ 2010-11-09 17:10 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46399

Andreas Krebbel <krebbel at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
           Priority|P3                          |P2
      Known to fail|                            |4.4.3, 4.5.2, 4.6.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/46399] Missing type promotion for library call argument
  2010-11-09 17:09 [Bug middle-end/46399] New: Missing type promotion for library call argument krebbel at gcc dot gnu.org
  2010-11-09 17:10 ` [Bug middle-end/46399] " krebbel at gcc dot gnu.org
@ 2011-05-09  8:56 ` krebbel at gcc dot gnu.org
  2011-05-09  9:24 ` krebbel at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: krebbel at gcc dot gnu.org @ 2011-05-09  8:56 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46399

Andreas Krebbel <krebbel at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |krebbel at gcc dot gnu.org
                   |gnu.org                     |


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/46399] Missing type promotion for library call argument
  2010-11-09 17:09 [Bug middle-end/46399] New: Missing type promotion for library call argument krebbel at gcc dot gnu.org
  2010-11-09 17:10 ` [Bug middle-end/46399] " krebbel at gcc dot gnu.org
  2011-05-09  8:56 ` krebbel at gcc dot gnu.org
@ 2011-05-09  9:24 ` krebbel at gcc dot gnu.org
  2013-07-31  7:59 ` krebbel at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: krebbel at gcc dot gnu.org @ 2011-05-09  9:24 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46399

Andreas Krebbel <krebbel at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.05.09 08:54:00
     Ever Confirmed|0                           |1
      Known to fail|                            |4.7.0

--- Comment #1 from Andreas Krebbel <krebbel at gcc dot gnu.org> 2011-05-09 08:54:00 UTC ---
Fixed for mainline with:

Re: [PING] Fix PR46399 - missing mode promotion for libcall args
http://gcc.gnu.org/ml/gcc-patches/2011-04/msg01354.html

plus the requested changes from:
http://gcc.gnu.org/ml/gcc-patches/2011-04/msg01988.html

and a build failure for PROMOTE_MODE targets fixed with:
svn revision: 173376

I'll request applying the backported patch after the fix did hang around for a
while in mainline.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/46399] Missing type promotion for library call argument
  2010-11-09 17:09 [Bug middle-end/46399] New: Missing type promotion for library call argument krebbel at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2013-07-31  7:59 ` krebbel at gcc dot gnu.org
@ 2013-07-31  7:59 ` krebbel at gcc dot gnu.org
  2013-07-31  7:59 ` krebbel at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: krebbel at gcc dot gnu.org @ 2013-07-31  7:59 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46399

Andreas Krebbel <krebbel at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |CLOSED

--- Comment #4 from Andreas Krebbel <krebbel at gcc dot gnu.org> ---
Closed.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/46399] Missing type promotion for library call argument
  2010-11-09 17:09 [Bug middle-end/46399] New: Missing type promotion for library call argument krebbel at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2011-05-09  9:24 ` krebbel at gcc dot gnu.org
@ 2013-07-31  7:59 ` krebbel at gcc dot gnu.org
  2013-07-31  7:59 ` krebbel at gcc dot gnu.org
  2013-07-31  7:59 ` krebbel at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: krebbel at gcc dot gnu.org @ 2013-07-31  7:59 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46399

Andreas Krebbel <krebbel at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from Andreas Krebbel <krebbel at gcc dot gnu.org> ---
Fixed.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/46399] Missing type promotion for library call argument
  2010-11-09 17:09 [Bug middle-end/46399] New: Missing type promotion for library call argument krebbel at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2013-07-31  7:59 ` krebbel at gcc dot gnu.org
@ 2013-07-31  7:59 ` krebbel at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: krebbel at gcc dot gnu.org @ 2013-07-31  7:59 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46399

--- Comment #3 from Andreas Krebbel <krebbel at gcc dot gnu.org> ---
Closed.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-07-31  7:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-09 17:09 [Bug middle-end/46399] New: Missing type promotion for library call argument krebbel at gcc dot gnu.org
2010-11-09 17:10 ` [Bug middle-end/46399] " krebbel at gcc dot gnu.org
2011-05-09  8:56 ` krebbel at gcc dot gnu.org
2011-05-09  9:24 ` krebbel at gcc dot gnu.org
2013-07-31  7:59 ` krebbel at gcc dot gnu.org
2013-07-31  7:59 ` krebbel at gcc dot gnu.org
2013-07-31  7:59 ` krebbel at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).