public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/41250]  New: hppa has DECL_VALUE_EXPR decls appearing in the function
@ 2009-09-03 19:07 jamborm at gcc dot gnu dot org
  2009-09-07 16:29 ` [Bug middle-end/41250] " jamborm at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: jamborm at gcc dot gnu dot org @ 2009-09-03 19:07 UTC (permalink / raw)
  To: gcc-bugs

When investigating PR 40464 I have come across a declaration with
DECL_HAS_VALUE_EXPR_P and DECL_VALUE_EXPR set (which indeed turned out
to be the root of the problem).  However, according to a comment in
tree.h: "once this field has been set, the decl itself may not
legitimately appear in the function."

Richard Guenther has written a patch to verify there are none such
declarations in the function statements and found none on an x86_64
(and so did I).  However, when I run the test on a hppa I got over two
hundred failures in the c testsuite alone.

The patch is at

  http://gcc.gnu.org/ml/gcc-patches/2009-08/msg00419.html

Steps to reproduce: 1) apply the patch above, 2) compile gcc (probably
irrespective of configuration but see below) and 3) run the c testsuite.

For the sake of completeness, I have configured gcc with:
  /home/jamborm/gcc/trunk/configure --prefix=/home/jamborm/gcc/inst/trunk/
--enable-checking=yes --enable-languages=c,c++ --disable-bootstrap
--with-mpfr=/opt/cfarm/mpfr-2.3.2/ --disable-multilib


-- 
           Summary: hppa has DECL_VALUE_EXPR decls appearing in the function
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jamborm at gcc dot gnu dot org
  GCC host triplet: hppa-linux-gnu
GCC target triplet: hppa-linux-gnu


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


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

* [Bug middle-end/41250] hppa has DECL_VALUE_EXPR decls appearing in the function
  2009-09-03 19:07 [Bug middle-end/41250] New: hppa has DECL_VALUE_EXPR decls appearing in the function jamborm at gcc dot gnu dot org
@ 2009-09-07 16:29 ` jamborm at gcc dot gnu dot org
  2009-09-11 23:38 ` jamborm at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jamborm at gcc dot gnu dot org @ 2009-09-07 16:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jamborm at gcc dot gnu dot org  2009-09-07 16:28 -------
We have discussed this in the mailing list thread that eventually lead
to http://gcc.gnu.org/ml/gcc-patches/2009-09/msg00374.html

The bottom line is that we two options:

1) Do not set DECL_VALUE_EXPR to callee copied parameters in
   gimplify_parameters() and represent the convention explicitely.  I
   have tested this preliminary by running the c testsuite (no
   bootstrap or some such thing) and so far found no ICEs or
   miscompilations.

   The drawback is that this approach will most probably mess up debug
   info and the link in between the original and actual parameter will
   get lost.  The benefit is that we would uphold the stated (but
   currently violated) rule that declarations with the DECL_VALUE_EXPR
   do not occur in the function body.

2) The second approach is to teach gimplifier not to do the
   substitutions which can be bogus.  Once the function body has been
   gimplifed, we might set some flag in the gimplification context or,
   alternatively, I'm about to try to simply disable the substitutions
   in gimplify_var_or_parm_decl() for PARM_DECLs.

   This would mean we would need to drop the rule not allowing such
   decls in the function body.  I don't know whether it needs to be
   replaced by some weaker restriction.


-- 

jamborm at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jamborm at gcc dot gnu dot
                   |                            |org


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


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

* [Bug middle-end/41250] hppa has DECL_VALUE_EXPR decls appearing in the function
  2009-09-03 19:07 [Bug middle-end/41250] New: hppa has DECL_VALUE_EXPR decls appearing in the function jamborm at gcc dot gnu dot org
  2009-09-07 16:29 ` [Bug middle-end/41250] " jamborm at gcc dot gnu dot org
@ 2009-09-11 23:38 ` jamborm at gcc dot gnu dot org
  2009-10-05 13:22 ` jamborm at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jamborm at gcc dot gnu dot org @ 2009-09-11 23:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jamborm at gcc dot gnu dot org  2009-09-11 23:38 -------
I ran into too many problems when I tried to inhibit value_expr
PARM_DECL substitutions in the gimplifier.  At the moment I believe we
should not use the value_expr just for debug info and rather try
BLOCK_NONLOCALIZED_VARS from pretty-ipa.  

I've just sent an email about this to the gcc mailing list:
http://gcc.gnu.org/ml/gcc/2009-09/msg00218.html


-- 


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


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

* [Bug middle-end/41250] hppa has DECL_VALUE_EXPR decls appearing in the function
  2009-09-03 19:07 [Bug middle-end/41250] New: hppa has DECL_VALUE_EXPR decls appearing in the function jamborm at gcc dot gnu dot org
  2009-09-07 16:29 ` [Bug middle-end/41250] " jamborm at gcc dot gnu dot org
  2009-09-11 23:38 ` jamborm at gcc dot gnu dot org
@ 2009-10-05 13:22 ` jamborm at gcc dot gnu dot org
  2010-02-26 19:05 ` sje at cup dot hp dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jamborm at gcc dot gnu dot org @ 2009-10-05 13:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jamborm at gcc dot gnu dot org  2009-10-05 13:22 -------
On IRC, Jakub told me to remove the value_expr flag after
gimplification and to introduce a new dummy var decl with the flag set
for the purpose of debugging.  My first attempt is the following
patch.  It did bootstrap on the hppa we have on the compile farm (over
the weekend :-) and the testsuite seem to have only one new
regression (g++.dg/inherit/thunk6.C).  I am about to do
a non-bootstrap build to examine that as well as the debug info
performance now.  

Nevertheless, I'll be grateful for any comments even at this stage,
expecially regarding attributes that need to be (or should not be)
copied to the new dummy declaration.  Those dealt with in the patch
are from copy_var_decl() in omp-low.c (which I did not call directly
because it sets DECL_SEEN_IN_BIND_EXPR_P).

2009-10-05  Martin Jambor  <mjambor@suse.cz>

        PR middle-end/41250
        * function.c (fixup_value_expr_parm_decls): New function.
        * tree.h (fixup_value_expr_parm_decls): Declare.
        * gimplify.c (gimplify_body): Call fixup_value_expr_parm_decls.

Index: small/gcc/function.c
===================================================================
--- small.orig/gcc/function.c
+++ small/gcc/function.c
@@ -3438,6 +3438,31 @@ gimplify_parameters (void)

   return stmts;
 }
+
+/* Remove DECL_HAS_VALUE_EXPR_P flag from parameters so that that such
+   declarations do not occur in the IL.  */
+
+void
+fixup_value_expr_parm_decls (void)
+{
+  tree parm, fnargs = DECL_ARGUMENTS (current_function_decl);
+
+  for (parm = fnargs; parm; parm = TREE_CHAIN (parm))
+    if (DECL_HAS_VALUE_EXPR_P (parm))
+      {
+       tree copy = build_decl (DECL_SOURCE_LOCATION (parm), VAR_DECL,
+                               DECL_NAME (parm), TREE_TYPE (parm));
+       DECL_ARTIFICIAL (copy) = DECL_ARTIFICIAL (parm);
+       DECL_IGNORED_P (copy) = DECL_IGNORED_P (parm);
+       DECL_CONTEXT (copy) = DECL_CONTEXT (parm);
+       TREE_USED (copy) = 1;
+       SET_DECL_VALUE_EXPR (copy, DECL_VALUE_EXPR (parm));
+       DECL_HAS_VALUE_EXPR_P (copy) = 1;
+
+       DECL_HAS_VALUE_EXPR_P (parm) = 0;
+       DECL_IGNORED_P (parm) = 1;
+      }
+}

 /* Compute the size and offset from the start of the stacked arguments for a
    parm passed in mode PASSED_MODE and with type TYPE.
Index: small/gcc/gimplify.c
===================================================================
--- small.orig/gcc/gimplify.c
+++ small/gcc/gimplify.c
@@ -7482,6 +7482,7 @@ gimplify_body (tree *body_p, tree fndecl
     {
       gimplify_seq_add_seq (&parm_stmts, gimple_bind_body (outer_bind));
       gimple_bind_set_body (outer_bind, parm_stmts);
+      fixup_value_expr_parm_decls ();
     }

   if (nonlocal_vlas)
Index: small/gcc/tree.h
===================================================================
--- small.orig/gcc/tree.h
+++ small/gcc/tree.h
@@ -4994,6 +4994,7 @@ extern int aggregate_value_p (const_tree
 extern void push_function_context (void);
 extern void pop_function_context (void);
 extern gimple_seq gimplify_parameters (void);
+extern void fixup_value_expr_parm_decls (void);

 /* In print-rtl.c */
 #ifdef BUFSIZ


-- 

jamborm at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at redhat dot com


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


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

* [Bug middle-end/41250] hppa has DECL_VALUE_EXPR decls appearing in the function
  2009-09-03 19:07 [Bug middle-end/41250] New: hppa has DECL_VALUE_EXPR decls appearing in the function jamborm at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2009-10-05 13:22 ` jamborm at gcc dot gnu dot org
@ 2010-02-26 19:05 ` sje at cup dot hp dot com
  2010-03-01 12:57 ` rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: sje at cup dot hp dot com @ 2010-02-26 19:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from sje at cup dot hp dot com  2010-02-26 19:05 -------
Was the patch from comment #3 ever sent to gcc-patches?  I couldn't find it.  I
did see earlier discussions about some other patches but the patch in comment
#3 seems to have been put here after those discussions.

I tested it on my hppa2.0w-hp-hpux11.11 system and it fixed
g++.dg/torture/pr34099.C and did not cause any regressions.


-- 


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


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

* [Bug middle-end/41250] hppa has DECL_VALUE_EXPR decls appearing in the function
  2009-09-03 19:07 [Bug middle-end/41250] New: hppa has DECL_VALUE_EXPR decls appearing in the function jamborm at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2010-02-26 19:05 ` sje at cup dot hp dot com
@ 2010-03-01 12:57 ` rguenth at gcc dot gnu dot org
  2010-03-01 13:14 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-03-01 12:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from rguenth at gcc dot gnu dot org  2010-03-01 12:57 -------
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         |2010-03-01 12:57:11
               date|                            |


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


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

* [Bug middle-end/41250] hppa has DECL_VALUE_EXPR decls appearing in the function
  2009-09-03 19:07 [Bug middle-end/41250] New: hppa has DECL_VALUE_EXPR decls appearing in the function jamborm at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2010-03-01 12:57 ` rguenth at gcc dot gnu dot org
@ 2010-03-01 13:14 ` rguenth at gcc dot gnu dot org
  2010-03-01 15:44 ` rguenth at gcc dot gnu dot org
  2010-03-01 15:44 ` rguenth at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-03-01 13:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rguenth at gcc dot gnu dot org  2010-03-01 13:14 -------
*** Bug 42805 has been marked as a duplicate of this bug. ***


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |danglin at gcc dot gnu dot
                   |                            |org


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


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

* [Bug middle-end/41250] hppa has DECL_VALUE_EXPR decls appearing in the function
  2009-09-03 19:07 [Bug middle-end/41250] New: hppa has DECL_VALUE_EXPR decls appearing in the function jamborm at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2010-03-01 13:14 ` rguenth at gcc dot gnu dot org
@ 2010-03-01 15:44 ` rguenth at gcc dot gnu dot org
  2010-03-01 15:44 ` rguenth at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-03-01 15:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from rguenth at gcc dot gnu dot org  2010-03-01 15:43 -------
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=41250


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

* [Bug middle-end/41250] hppa has DECL_VALUE_EXPR decls appearing in the function
  2009-09-03 19:07 [Bug middle-end/41250] New: hppa has DECL_VALUE_EXPR decls appearing in the function jamborm at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2010-03-01 15:44 ` rguenth at gcc dot gnu dot org
@ 2010-03-01 15:44 ` rguenth at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-03-01 15:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from rguenth at gcc dot gnu dot org  2010-03-01 15:44 -------
Subject: Bug 41250

Author: rguenth
Date: Mon Mar  1 15:43:32 2010
New Revision: 157148

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157148
Log:
2010-03-01  Richard Guenther  <rguenther@suse.de>
        Martin Jambor  <mjambor@suse.cz>

        PR middle-end/41250
        * gimplify.c (gimplify_body): Unset DECL_HAS_VALUE_EXPR_P on
        gimplified parameters.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gimplify.c


-- 


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


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

end of thread, other threads:[~2010-03-01 15:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-03 19:07 [Bug middle-end/41250] New: hppa has DECL_VALUE_EXPR decls appearing in the function jamborm at gcc dot gnu dot org
2009-09-07 16:29 ` [Bug middle-end/41250] " jamborm at gcc dot gnu dot org
2009-09-11 23:38 ` jamborm at gcc dot gnu dot org
2009-10-05 13:22 ` jamborm at gcc dot gnu dot org
2010-02-26 19:05 ` sje at cup dot hp dot com
2010-03-01 12:57 ` rguenth at gcc dot gnu dot org
2010-03-01 13:14 ` rguenth at gcc dot gnu dot org
2010-03-01 15:44 ` rguenth at gcc dot gnu dot org
2010-03-01 15:44 ` 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).