public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/15908] New: Invalid codegen: long long function
@ 2004-06-09 23:55 dalej at apple dot com
  2004-06-09 23:56 ` [Bug rtl-optimization/15908] " pinskia at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: dalej at apple dot com @ 2004-06-09 23:55 UTC (permalink / raw)
  To: gcc-bugs

The following fails on Darwin with -O2.   (analysis afterwards)

extern long long xx(int) __attribute__((noinline));
long long array[60];
int foo() {
  int i;
  for (i=0; i<60; i++)
    array[i] = xx(i);
}
long long xx(int i)
{
  return ((long long)i)<<32;
}
int main() { 
    foo();
    if (array[7] != ((long long)7)<<32)
      abort();
}

Basic problem is that Darwin uses DImode Parallel for long long function returns, which falls through 
the cracks in df.c:df_def_record_1().  I'm pretty sure the following patch is right for ppc, but I'm not 
sure what non-BLKmode parallel is used for on other targets....

Index: df.c
===============================================================
====
RCS file: /cvs/gcc/gcc/gcc/df.c,v
retrieving revision 1.32.2.16.2.3
diff -u -d -b -w -c -3 -p -r1.32.2.16.2.3 df.c
cvs diff: conflicting specifications of output style
*** df.c        7 Jun 2004 17:04:49 -0000       1.32.2.16.2.3
--- df.c        9 Jun 2004 23:53:17 -0000
*************** df_def_record_1 (struct df *df, rtx x, b
*** 888,896 ****
      loc = &SET_DEST (x);
    dst = *loc;
  
!   /* Some targets place small structures in registers for
       return values of functions.  */
!   if (GET_CODE (dst) == PARALLEL && GET_MODE (dst) == BLKmode)
      {
        int i;
  
--- 888,896 ----
      loc = &SET_DEST (x);
    dst = *loc;
  
!   /* Some targets place small structures or 64-bit ints in registers for
       return values of functions.  */
!   if (GET_CODE (dst) == PARALLEL)
      {
        int i;

-- 
           Summary: Invalid codegen: long long function
           Product: gcc
           Version: lno
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dalej at apple dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: powerpc-apple-darwin7.3.0
  GCC host triplet: powerpc-apple-darwin7.3.0
GCC target triplet: powerpc-apple-darwin7.3.0


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


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

end of thread, other threads:[~2004-09-24 13:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-09 23:55 [Bug rtl-optimization/15908] New: Invalid codegen: long long function dalej at apple dot com
2004-06-09 23:56 ` [Bug rtl-optimization/15908] " pinskia at gcc dot gnu dot org
2004-06-10  0:00 ` pinskia at gcc dot gnu dot org
2004-06-10  1:02 ` pinskia at gcc dot gnu dot org
2004-06-10 14:21 ` rakdver at gcc dot gnu dot org
2004-06-10 20:03 ` dalej at apple dot com
2004-06-10 21:07 ` rakdver at atrey dot karlin dot mff dot cuni dot cz
2004-06-10 21:13 ` dalej at apple dot com
2004-07-28 21:36 ` pinskia at gcc dot gnu dot org
2004-09-24 13:03 ` pinskia at gcc dot gnu dot 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).