public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/34037]  New: [4.1/4.2/4.3 Regression] Bounds for VLAs not emitted into debuginfo
@ 2007-11-08 22:49 jakub at gcc dot gnu dot org
  2007-11-09  7:32 ` [Bug debug/34037] " jakub at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-11-08 22:49 UTC (permalink / raw)
  To: gcc-bugs

With -g -O0 -dA
void bar (char *, char *, char *, int size);
void foo (int size)
{
  char temp[size];
  char temp3[48];
  temp[size-1] = '\0';
  {
    char temp2[size];
    bar (temp, temp2, temp3, size);
  }
};

in 3.4.x we got:
...
        .uleb128 0x4    # (DIE (0x74) DW_TAG_variable)
        .byte   0x1     # DW_AT_artificial
        .long   0x104   # DW_AT_type
        .byte   0x6     # DW_AT_location
        .byte   0x91    # DW_OP_fbreg
        .sleb128 -20
        .byte   0x94    # DW_OP_deref_size
        .byte   0x4
        .byte   0x31    # DW_OP_lit1
        .byte   0x1c    # DW_OP_minus
...
        .uleb128 0x8    # (DIE (0xdc) DW_TAG_array_type)
        .long   0xef    # DW_AT_sibling
        .long   0x115   # DW_AT_type
        .uleb128 0x9    # (DIE (0xe5) DW_TAG_subrange_type)
        .long   0xef    # DW_AT_type
        .long   0x74    # DW_AT_upper_bound
        .byte   0x0     # end of children of DIE 0xdc

but 4.1/4.2/4.3 only have DW_AT_upper_bound for temp3 array where it is
constant.

There seem to be 2 problems.  When gimplifying, the vars are gimplified into
temp vars in gimplify_type_sizes and as those vars are DECL_ARTIFICIAL and
DECL_IGNORED_P, they are usually even at -O0 just deleted as trivially dead
e.g. by CSE.  This part could be fixed say by:
--- gcc/gimplify.c.jj   2007-10-30 11:46:29.000000000 +0100
+++ gcc/gimplify.c      2007-11-08 22:50:35.000000000 +0100
@@ -6171,6 +6171,18 @@ gimplify_type_sizes (tree type, tree *li
       /* These types may not have declarations, so handle them here.  */
       gimplify_type_sizes (TREE_TYPE (type), list_p);
       gimplify_type_sizes (TYPE_DOMAIN (type), list_p);
+      /* When not optimizing, ensure VLA bounds aren't removed.  */
+      if (!optimize
+         && TYPE_DOMAIN (type)
+         && INTEGRAL_TYPE_P (TYPE_DOMAIN (type)))
+       {
+         t = TYPE_MIN_VALUE (TYPE_DOMAIN (type));
+         if (t && TREE_CODE (t) == VAR_DECL && DECL_ARTIFICIAL (t))
+           DECL_IGNORED_P (t) = 0;
+         t = TYPE_MAX_VALUE (TYPE_DOMAIN (type));
+         if (t && TREE_CODE (t) == VAR_DECL && DECL_ARTIFICIAL (t))
+           DECL_IGNORED_P (t) = 0;
+       }
       break;

     case RECORD_TYPE:
The next problem is on the dwarf2out.c side, in add_bound_info we have:
        dw_die_ref decl_die = lookup_decl_die (bound);

        /* ??? Can this happen, or should the variable have been bound
           first?  Probably it can, since I imagine that we try to create
           the types of parameters in the order in which they exist in
           the list, and won't have created a forward reference to a
           later parameter.  */
        if (decl_die != NULL)
          add_AT_die_ref (subrange_die, bound_attr, decl_die);

It seems most even non-artificial VAR_DECLs aren't even
equate_decl_number_to_die'ed, so lookup_decl_die won't find them anyway.
Ideas?  For -O1 and above, I guess we need to wait for Alex or some alternate
representation which would allow us to see how can they be computed even if
they were optimized out.


-- 
           Summary: [4.1/4.2/4.3 Regression] Bounds for VLAs not emitted
                    into debuginfo
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org


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


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

* [Bug debug/34037] [4.1/4.2/4.3 Regression] Bounds for VLAs not emitted into debuginfo
  2007-11-08 22:49 [Bug debug/34037] New: [4.1/4.2/4.3 Regression] Bounds for VLAs not emitted into debuginfo jakub at gcc dot gnu dot org
@ 2007-11-09  7:32 ` jakub at gcc dot gnu dot org
  2007-11-09 13:56 ` jakub at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-11-09  7:32 UTC (permalink / raw)
  To: gcc-bugs



-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-11-09 07:32:12
               date|                            |
   Target Milestone|---                         |4.1.3


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


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

* [Bug debug/34037] [4.1/4.2/4.3 Regression] Bounds for VLAs not emitted into debuginfo
  2007-11-08 22:49 [Bug debug/34037] New: [4.1/4.2/4.3 Regression] Bounds for VLAs not emitted into debuginfo jakub at gcc dot gnu dot org
  2007-11-09  7:32 ` [Bug debug/34037] " jakub at gcc dot gnu dot org
@ 2007-11-09 13:56 ` jakub at gcc dot gnu dot org
  2007-11-09 13:57 ` jakub at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-11-09 13:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jakub at gcc dot gnu dot org  2007-11-09 13:56 -------
I have tried:
--- dwarf2out.c.jj9     2007-11-05 09:05:44.000000000 +0100
+++ dwarf2out.c 2007-11-09 14:29:04.000000000 +0100
@@ -11032,6 +11032,26 @@ add_bound_info (dw_die_ref subrange_die,
           later parameter.  */
        if (decl_die != NULL)
          add_AT_die_ref (subrange_die, bound_attr, decl_die);
+       /* Handle gimplified type bounds.  */
+        else if (TREE_CODE (bound) == VAR_DECL
+                && DECL_ARTIFICIAL (bound)
+                && !DECL_NAME (bound)
+                && !TREE_STATIC (bound)
+                && current_function_decl
+                && (lookup_decl_loc (bound)
+                    || loc_descriptor_from_tree (bound)))
+         {
+           dw_die_ref ctx, decl_die;
+
+           ctx = lookup_decl_die (current_function_decl);
+
+           decl_die = new_die (DW_TAG_variable, ctx, bound);
+           add_AT_flag (decl_die, DW_AT_artificial, 1);
+           add_type_attribute (decl_die, TREE_TYPE (bound), 1, 0, ctx);
+           add_location_or_const_value_attribute (decl_die, bound,
+                                                  DW_AT_location);
+           add_AT_die_ref (subrange_die, bound_attr, decl_die);
+         }
        break;
       }

but that still doesn't work, because instantiate_decl etc. hasn't been called
on this, only BLOCK_VARS are treated that way.  So, either we need to put these
artificial vars into BLOCK_VARS, or find a way to also keep the original
non-gimplified expression in TYPE_DOMAIN.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.1.3                       |---


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


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

* [Bug debug/34037] [4.1/4.2/4.3 Regression] Bounds for VLAs not emitted into debuginfo
  2007-11-08 22:49 [Bug debug/34037] New: [4.1/4.2/4.3 Regression] Bounds for VLAs not emitted into debuginfo jakub at gcc dot gnu dot org
  2007-11-09  7:32 ` [Bug debug/34037] " jakub at gcc dot gnu dot org
  2007-11-09 13:56 ` jakub at gcc dot gnu dot org
@ 2007-11-09 13:57 ` jakub at gcc dot gnu dot org
  2007-11-27  5:58 ` mmitchel at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-11-09 13:57 UTC (permalink / raw)
  To: gcc-bugs



-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.1.3


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


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

* [Bug debug/34037] [4.1/4.2/4.3 Regression] Bounds for VLAs not emitted into debuginfo
  2007-11-08 22:49 [Bug debug/34037] New: [4.1/4.2/4.3 Regression] Bounds for VLAs not emitted into debuginfo jakub at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-11-09 13:57 ` jakub at gcc dot gnu dot org
@ 2007-11-27  5:58 ` mmitchel at gcc dot gnu dot org
  2008-02-05  5:59 ` aoliva at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-11-27  5:58 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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


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

* [Bug debug/34037] [4.1/4.2/4.3 Regression] Bounds for VLAs not emitted into debuginfo
  2007-11-08 22:49 [Bug debug/34037] New: [4.1/4.2/4.3 Regression] Bounds for VLAs not emitted into debuginfo jakub at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-11-27  5:58 ` mmitchel at gcc dot gnu dot org
@ 2008-02-05  5:59 ` aoliva at gcc dot gnu dot org
  2008-02-05 13:49 ` jakub at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: aoliva at gcc dot gnu dot org @ 2008-02-05  5:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from aoliva at gcc dot gnu dot org  2008-02-05 05:58 -------
I don't see that preserving the information can be accomplished in a simpler
way than what's being implemented in the VTA branch :-(  Any other attempt to
retain  an expression that is not used anywhere, is such that it will either
still be optimized away, require the generated code to change to keep it
available, or be essentially equivalent to the VTA branch approach.  I guess
this is a DEFERRED, unless we want to force the expression live.


-- 


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


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

* [Bug debug/34037] [4.1/4.2/4.3 Regression] Bounds for VLAs not emitted into debuginfo
  2007-11-08 22:49 [Bug debug/34037] New: [4.1/4.2/4.3 Regression] Bounds for VLAs not emitted into debuginfo jakub at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2008-02-05  5:59 ` aoliva at gcc dot gnu dot org
@ 2008-02-05 13:49 ` jakub at gcc dot gnu dot org
  2008-07-04 22:21 ` [Bug debug/34037] [4.2/4.3/4.4 " jsm28 at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-02-05 13:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2008-02-05 13:49 -------
For -O1 and higher I of course expect this to be DEFERRED until we have
infrastructure.  But for -O0 we IMHO can and should keep the expressions
around.


-- 


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


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

* [Bug debug/34037] [4.2/4.3/4.4 Regression] Bounds for VLAs not emitted into debuginfo
  2007-11-08 22:49 [Bug debug/34037] New: [4.1/4.2/4.3 Regression] Bounds for VLAs not emitted into debuginfo jakub at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2008-02-05 13:49 ` jakub at gcc dot gnu dot org
@ 2008-07-04 22:21 ` jsm28 at gcc dot gnu dot org
  2008-09-11 13:51 ` jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-07-04 22:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jsm28 at gcc dot gnu dot org  2008-07-04 22:20 -------
Closing 4.1 branch.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.1/4.2/4.3/4.4 Regression]|[4.2/4.3/4.4 Regression]
                   |Bounds for VLAs not emitted |Bounds for VLAs not emitted
                   |into debuginfo              |into debuginfo
   Target Milestone|4.1.3                       |4.2.5


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


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

* [Bug debug/34037] [4.2/4.3/4.4 Regression] Bounds for VLAs not emitted into debuginfo
  2007-11-08 22:49 [Bug debug/34037] New: [4.1/4.2/4.3 Regression] Bounds for VLAs not emitted into debuginfo jakub at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2008-07-04 22:21 ` [Bug debug/34037] [4.2/4.3/4.4 " jsm28 at gcc dot gnu dot org
@ 2008-09-11 13:51 ` jakub at gcc dot gnu dot org
  2008-09-18 15:20 ` jakub at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-09-11 13:51 UTC (permalink / raw)
  To: gcc-bugs



-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jakub at gcc dot gnu dot org
                   |dot org                     |
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2008-
                   |                            |09/msg00903.html
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-11-09 07:32:12         |2008-09-11 13:50:04
               date|                            |


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


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

* [Bug debug/34037] [4.2/4.3/4.4 Regression] Bounds for VLAs not emitted into debuginfo
  2007-11-08 22:49 [Bug debug/34037] New: [4.1/4.2/4.3 Regression] Bounds for VLAs not emitted into debuginfo jakub at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2008-09-18 15:20 ` jakub at gcc dot gnu dot org
@ 2008-09-18 15:20 ` jakub at gcc dot gnu dot org
  2009-04-29 15:17 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-09-18 15:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jakub at gcc dot gnu dot org  2008-09-18 15:18 -------
Subject: Bug 34037

Author: jakub
Date: Thu Sep 18 15:17:10 2008
New Revision: 140459

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=140459
Log:
        PR debug/34037
        * gimplify.c (gimplify_type_sizes): When not optimizing, ensure
        TYPE_MIN_VALUE and TYPE_MAX_VALUE is not is not DECL_IGNORED_P
        VAR_DECL.
        * cfgexpand.c (expand_used_vars): Keep DECL_ARTIFICIAL
        !DECL_IGNORED_P vars in local_decls list for instantiate_decls,
        ggc_free other TREE_LIST nodes from that chain.
        * function.c (instantiate_decls): Instantiate also DECL_RTL
        of vars in cfun->local_decls, free that list afterwards.

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


-- 


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


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

* [Bug debug/34037] [4.2/4.3/4.4 Regression] Bounds for VLAs not emitted into debuginfo
  2007-11-08 22:49 [Bug debug/34037] New: [4.1/4.2/4.3 Regression] Bounds for VLAs not emitted into debuginfo jakub at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2008-09-11 13:51 ` jakub at gcc dot gnu dot org
@ 2008-09-18 15:20 ` jakub at gcc dot gnu dot org
  2008-09-18 15:20 ` jakub at gcc dot gnu dot org
  2009-04-29 15:17 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-09-18 15:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jakub at gcc dot gnu dot org  2008-09-18 15:18 -------
Fixed on the trunk.


-- 

jakub at gcc dot gnu dot org changed:

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


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


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

* [Bug debug/34037] [4.2/4.3/4.4 Regression] Bounds for VLAs not emitted into debuginfo
  2007-11-08 22:49 [Bug debug/34037] New: [4.1/4.2/4.3 Regression] Bounds for VLAs not emitted into debuginfo jakub at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2008-09-18 15:20 ` jakub at gcc dot gnu dot org
@ 2009-04-29 15:17 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-04-29 15:17 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.2.5                       |4.4.0


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


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

end of thread, other threads:[~2009-04-29 15:17 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-08 22:49 [Bug debug/34037] New: [4.1/4.2/4.3 Regression] Bounds for VLAs not emitted into debuginfo jakub at gcc dot gnu dot org
2007-11-09  7:32 ` [Bug debug/34037] " jakub at gcc dot gnu dot org
2007-11-09 13:56 ` jakub at gcc dot gnu dot org
2007-11-09 13:57 ` jakub at gcc dot gnu dot org
2007-11-27  5:58 ` mmitchel at gcc dot gnu dot org
2008-02-05  5:59 ` aoliva at gcc dot gnu dot org
2008-02-05 13:49 ` jakub at gcc dot gnu dot org
2008-07-04 22:21 ` [Bug debug/34037] [4.2/4.3/4.4 " jsm28 at gcc dot gnu dot org
2008-09-11 13:51 ` jakub at gcc dot gnu dot org
2008-09-18 15:20 ` jakub at gcc dot gnu dot org
2008-09-18 15:20 ` jakub at gcc dot gnu dot org
2009-04-29 15:17 ` 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).