This is the mail archive of the gcc-patches@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]

[RFA] Fix abort in dwarf2out.c due to MIN_EXPR


Hello,

Using GCC from CVS (version shows "3.5.0 20040312 (experimental)"),
we got a GCC error message by compiling the code appended at the
end of this message:

    % gcc -c -g foo.adb
    +===========================GNAT BUG DETECTED====================+
    | 3.5.0 20040312 (experimental) (i686-pc-linux-gnu) GCC error:   |
    | in loc_descriptor_from_tree, at dwarf2out.c:9065               |
    | Error detected at foo.adb:10:8                                 |
    | Please submit a bug report; see http://gcc.gnu.org/bugs.html.  |
    | Include the entire contents of this bug box in the report.     |
    | Include the exact gcc or gnatmake command that you entered.    |
    | Also include sources listed below in gnatchop format           |
    | (concatenated together with no headers between files).         |
    +================================================================+

The problem arises when we try to generate the info for the upper
bound of type T, which is defined inside Generic_Select_Elements.
GCC aborts because it encounters a MIN_EXPR tree node while inside
loc_descriptor_from_tree(), and doesn't know how to handle it.
Surprisingly, it already knows how to handle MAX_EXPR, so I used
the same code to add handling for MIN_EXPR as well.

Tested on x86-linux using the GCC testsuite and the GDB testsuite.
GCC also compiles the given example fine once my patch is applied.

2004-03-15  J. Brobecker  <brobecker@gnat.com>

        * dwarf2out.c (loc_descriptor_from_tree): Add handling for MIN_EXPR.

OK to apply?

-- 
Joel

<<
package Foo is

   type Index_Type is range 1 .. 50;

   type Element_Array_Type is
      array (Index_Type range <>) of Integer;

   type Container_Type (Elements_Last : Index_Type) is
      limited record
         Elements : Element_Array_Type (1 .. Elements_Last);
         Last     : Index_Type;
      end record;

   procedure Generic_Select_Elements
     (Container : in Container_Type);

end Foo;
package body Foo is

   procedure Generic_Select_Elements
     (Container : in Container_Type)
   is
      subtype T is Index_Type'Base range
         Index_Type'First .. Container.Last;
   begin
      null;
   end Generic_Select_Elements;

end Foo;
>>

Attachment: min_expr-gcc-head.diff
Description: Text document


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