This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/13779] New: PPC-darwin Correct initialization of 'long long' with constant


-mpowerpc64 for PPC has a bug passing constant to a function expecting
'long long'. The MSW is
incorrectly passed to the function. So, in the following code fragment:


void LL(long long);
...
LL(1);

We generate:


_main:
         li r3,1                                <--- bad!
         li r4,1
         b L_LL$stub

Test case:

/* { dg-do compile { target powerpc*-*-darwin* } } */
/* { dg-options "-O2 -force_cpusubtype_ALL -mpowerpc64" } */

int  msw(long long in)
{
  union {
    long long ll;
    int  i[2];
  } ud;
  ud.ll = in;
  return ud.i[0];
}

int main()
{
  return msw(1) != 0;
}

patch is here:  <http://gcc.gnu.org/ml/gcc-patches/2004-01/msg01497.html>

-- 
           Summary: PPC-darwin Correct initialization of 'long long' with
                    constant
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: middle-end
        AssignedTo: fjahanian at apple dot com
        ReportedBy: fjahanian at apple dot com
                CC: dje at gcc dot gnu dot org,gcc-bugs at gcc dot gnu dot
                    org,pinskia at gcc dot gnu dot org
GCC target triplet: powerpc-*-*


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]