public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug regression/40001]  New: [4.5 Regression] r1467817 broke libgloss build for SPU
@ 2009-05-01 23:04 tsmigiel at gcc dot gnu dot org
  2009-05-02  2:34 ` [Bug regression/40001] [4.5 Regression] r146817 " matz at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: tsmigiel at gcc dot gnu dot org @ 2009-05-01 23:04 UTC (permalink / raw)
  To: gcc-bugs

The following test case, simplified from newlib's libgloss/spu/sbrk.c, breaks a
combined SPU build.  This test case works if sp_r1 is declared globally.  

It fails at the new assert in cfgexpand.c:expand_one_var() which tests
DECL_HARD_REGISTER.

void *
sbrk (unsigned int increment)
{
  volatile register
    __attribute__ ((__spu_vector__)) unsigned int sp_r1 __asm__ ("1");
  unsigned int sps;

  sps = __builtin_spu_extract (sp_r1, 0);
  if (sps - 4096 >= increment)
    return 0;
  else
    return ((void *) -1);
}


-- 
           Summary: [4.5 Regression] r1467817 broke libgloss build for SPU
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: regression
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tsmigiel at gcc dot gnu dot org
GCC target triplet: spu-*-*


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


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

* [Bug regression/40001] [4.5 Regression] r146817 broke libgloss build for SPU
  2009-05-01 23:04 [Bug regression/40001] New: [4.5 Regression] r1467817 broke libgloss build for SPU tsmigiel at gcc dot gnu dot org
@ 2009-05-02  2:34 ` matz at gcc dot gnu dot org
  2009-05-02 10:45 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: matz at gcc dot gnu dot org @ 2009-05-02  2:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from matz at gcc dot gnu dot org  2009-05-02 02:34 -------
The assert triggers because of a real pre-existing bug.  local variables
with DECL_HARD_REGISTER set must not be put into SSA form.  is_gimple_reg
has to return false for them.  It doesn't anymore since some changes by richi
(CCed), I think.

Te update_address_taken pass sets DECL_GIMPLE_REG_P on the sp_r1 variable.
This is because of the special handling of vector modes.  But it doesn't take
into account variables which can't be gimple_reg for other reasons than simply
being of wrong type.

I think the 2009-03-31 change in is_gimple_reg that moved the DECL_GIMPLE_REG_P
handling earlier might be the cause.  But fixing it there
probably is not enough, it's better to not set DECL_GIMPLE_REG_P at all
on this VAR_DECL.

The same is true for volatile decl (in this example it has a hardreg _and_
is volatile even), which also seems to be ignored in the address_taken
pass.

This whole business of special-casing COMPLEX_TYPE and VECTOR_TYPE regarding
gimple regs seems highly dubious to me.  The different places setting this
flag freely use a random mixture of tests on
          !TREE_THIS_VOLATILE (t)
and/or
          (TREE_CODE (t) == VAR_DECL && !DECL_HARD_REGISTER (t))
and/or
          !needs_to_live_in_memory (t))
or sometimes nothing at all.  In fact at least all three of these tests
are required everywhere, except where it's clear that we just created a 
completely new temporary.

Meanwhile the immediate problem can be fixed by the below patch:

Index: tree-ssa.c
===================================================================
--- tree-ssa.c  (Revision 147044)
+++ tree-ssa.c  (Arbeitskopie)
@@ -1573,7 +1573,10 @@ execute_update_addresses_taken (bool do_
        if (!DECL_GIMPLE_REG_P (var)
            && !bitmap_bit_p (not_reg_needs, DECL_UID (var))
            && (TREE_CODE (TREE_TYPE (var)) == COMPLEX_TYPE
-               || TREE_CODE (TREE_TYPE (var)) == VECTOR_TYPE))
+               || TREE_CODE (TREE_TYPE (var)) == VECTOR_TYPE)
+           && !TREE_THIS_VOLATILE (var)
+           && (TREE_CODE (var) == VAR_DECL && !DECL_HARD_REGISTER (var))
+           && !needs_to_live_in_memory (var))
          {
            DECL_GIMPLE_REG_P (var) = 1;
            mark_sym_for_renaming (var);


-- 

matz at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org
            Summary|[4.5 Regression] r1467817   |[4.5 Regression] r146817
                   |broke libgloss build for SPU|broke libgloss build for SPU


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


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

* [Bug regression/40001] [4.5 Regression] r146817 broke libgloss build for SPU
  2009-05-01 23:04 [Bug regression/40001] New: [4.5 Regression] r1467817 broke libgloss build for SPU tsmigiel at gcc dot gnu dot org
  2009-05-02  2:34 ` [Bug regression/40001] [4.5 Regression] r146817 " matz at gcc dot gnu dot org
@ 2009-05-02 10:45 ` rguenth at gcc dot gnu dot org
  2009-05-02 17:49 ` rguenth at gcc dot gnu dot org
  2009-05-02 17:51 ` rguenth at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-05-02 10:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2009-05-02 10:45 -------
Mine.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-05-02 10:45:33
               date|                            |
   Target Milestone|---                         |4.5.0


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


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

* [Bug regression/40001] [4.5 Regression] r146817 broke libgloss build for SPU
  2009-05-01 23:04 [Bug regression/40001] New: [4.5 Regression] r1467817 broke libgloss build for SPU tsmigiel at gcc dot gnu dot org
  2009-05-02  2:34 ` [Bug regression/40001] [4.5 Regression] r146817 " matz at gcc dot gnu dot org
  2009-05-02 10:45 ` rguenth at gcc dot gnu dot org
@ 2009-05-02 17:49 ` rguenth at gcc dot gnu dot org
  2009-05-02 17:51 ` rguenth at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-05-02 17:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2009-05-02 17:49 -------
Subject: Bug 40001

Author: rguenth
Date: Sat May  2 17:49:32 2009
New Revision: 147064

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=147064
Log:
2009-05-02  Richard Guenther  <rguenther@suse.de>

        PR middle-end/40001
        * tree-ssa.c (execute_update_addresses_taken): Properly check
        if we can mark a variable DECL_GIMPLE_REG_P.
        * gimple.c (is_gimple_reg): Re-order check for DECL_GIMPLE_REG_P
        back to the end of the function.
        (is_gimple_reg_type): Remove complex type special casing.
        * gimplify.c (gimplify_bind_expr): Do not set DECL_GIMPLE_REG_P
        if not optimizing.

        * gcc.target/spu/pr40001.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.target/spu/pr40001.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gimple.c
    trunk/gcc/gimplify.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa.c


-- 


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


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

* [Bug regression/40001] [4.5 Regression] r146817 broke libgloss build for SPU
  2009-05-01 23:04 [Bug regression/40001] New: [4.5 Regression] r1467817 broke libgloss build for SPU tsmigiel at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2009-05-02 17:49 ` rguenth at gcc dot gnu dot org
@ 2009-05-02 17:51 ` rguenth at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-05-02 17:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2009-05-02 17:50 -------
Supposedly fixed.


-- 

rguenth at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2009-05-02 17:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-01 23:04 [Bug regression/40001] New: [4.5 Regression] r1467817 broke libgloss build for SPU tsmigiel at gcc dot gnu dot org
2009-05-02  2:34 ` [Bug regression/40001] [4.5 Regression] r146817 " matz at gcc dot gnu dot org
2009-05-02 10:45 ` rguenth at gcc dot gnu dot org
2009-05-02 17:49 ` rguenth at gcc dot gnu dot org
2009-05-02 17:51 ` rguenth 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).