Bug 19183 - [3.4 Regression] ICE with -fPIC
Summary: [3.4 Regression] ICE with -fPIC
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 3.4.2
: P3 normal
Target Milestone: 3.4.6
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2004-12-28 23:04 UTC by ddavenpo
Modified: 2006-02-28 09:50 UTC (History)
3 users (show)

See Also:
Host: sparc-sun-solaris2.8
Target: sparc-sun-solaris2.8
Build: 3.4.2
Known to work: 3.3.2 4.0.0
Known to fail: 3.4.3 3.4.4
Last reconfirmed: 2006-01-06 15:29:01


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ddavenpo 2004-12-28 23:04:22 UTC
This error does not occur without the -fPIC option.

+===========================GNAT BUG DETECTED==============================+
| 3.4.2 (sparc-sun-solaris2.8) Constraint_Error SIGSEGV                    |
| Error detected at parm_tbl.ads:39:9                                      |
| 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).                   |
+==========================================================================+

33 % gcc -c -I../source/ -fPIC ../source/parm_tbl.ads
36 % gcc -v
Reading specs from /data/local/bin/../lib/gcc/sparc-sun-solaris2.8/3.4.2/specs
Configured with: /data/buildgcc/gcc-3.4.2/configure --enable-languages=ada,c,c++
Thread model: posix
gcc version 3.4.2

with Global_Defs;

package Parm_Tbl is

   CIDS : constant STRING := "$Id: parm_tbl.1.ada,v 1.3 04/21/2004 16:11:00 bill
Exp $";

   PARAMETER_TABLE_SIZE : constant := 10_000;

   subtype PARAMETER_TABLE_TYPE is
      Global_Defs.WORD_ARRAY( 0 .. PARAMETER_TABLE_SIZE - 1 );

   subtype PARAMETER_BYTES_TABLE_TYPE is
      Global_Defs.BYTE_ARRAY( 0 .. PARAMETER_TABLE_TYPE'Last *
Global_Defs.BYTES_PER_WORD );

   type FULL_PARAMETER_TABLE_TYPE is
      record
         Version  : Global_Defs.WORD32;
         Element  : PARAMETER_TABLE_TYPE;
   end record;

   Full_Parameter_Table : FULL_PARAMETER_TABLE_TYPE;

   Parameter_Table      : PARAMETER_TABLE_TYPE;
   for Parameter_Table'Address use Full_Parameter_Table.Element'Address;

   Parameter_Byte_Table : PARAMETER_BYTES_TABLE_TYPE;
   for Parameter_Byte_Table'Address use Parameter_Table'Address;

end Parm_Tbl;

with Interfaces;
with Ada.Numerics;
with System.Storage_Elements;

package Global_Defs is

   Id : constant String :=
      "$Id: global_defs.1.ada,v 1.6 11/17/2003 22:44:43 jeff Exp $";

   --*****************************************************************
   -- Type declarations
   --*****************************************************************

   -- Floating Point

   subtype REAL32 is FLOAT;
   subtype REAL is LONG_FLOAT;

   -- Signed Integer

   subtype INT16 is Interfaces.INTEGER_16;
   subtype INT32 is Interfaces.INTEGER_32;

   -- Unsigned Integer

   BYTE_SIZE : constant := 8;                    -- in bits

   WORD_SIZE : constant := 2 * BYTE_SIZE;         -- in bits

   WORD32_SIZE : constant := 4 * BYTE_SIZE;         -- in bits

   BYTES_PER_WORD32 : constant := WORD32_SIZE / BYTE_SIZE;

   BYTES_PER_WORD : constant := WORD_SIZE / BYTE_SIZE;

   WORDS_PER_WORD32 : constant := WORD32_SIZE / WORD_SIZE;

   type BYTE is new Interfaces.UNSIGNED_8;

   type WORD is new Interfaces.UNSIGNED_16;

   type WORD32 is new Interfaces.UNSIGNED_32;

   type BYTE_PTR is access BYTE;

   type WORD_PTR is access WORD;

   type WORD32_PTR is access WORD32;

   type BYTE_ARRAY is array (NATURAL range <>) of BYTE;
   pragma Pack (BYTE_ARRAY);

   type WORD_ARRAY is array (NATURAL range <>) of WORD;
   pragma Pack (WORD_ARRAY);

   type WORD32_ARRAY is array (NATURAL range <>) of WORD32;
   pragma Pack (WORD32_ARRAY);

   -- Misc. enumeration types
   type USABILITY_TYPE is (Good, Coarse, Bad);
   for USABILITY_TYPE use (Good => 0, Coarse => 1, Bad => 2);

   type STORAGE_BYTE_ARRAY is new System.Storage_Elements.STORAGE_ARRAY;
   pragma Pack (STORAGE_BYTE_ARRAY);

   type BIT32 is mod 2 ** 5;

   type BIT32_ARRAY is array (BIT32'Range) of BOOLEAN;
   pragma Pack (BIT32_ARRAY);
   for BIT32_ARRAY'Size use WORD32_SIZE;

   -- units

   subtype RADIANS is REAL;
   subtype RAD_CYCLE is REAL;       -- radians/cycle
   subtype RAD_CYCLE_RAD is REAL;   -- radians/cycle/radian
   subtype RAD_CYCLE_SQ is REAL;    -- radians/cycle**2
   subtype RAD_SEC is REAL;         -- radians/second
   subtype RAD_SEC_SQ is REAL;      -- radians/second**2

   subtype DEGREES is REAL;

   subtype KGM_SQ is REAL;              -- kilograms**2

   subtype KILOMETERS is REAL;
   subtype KM_SQ is REAL;               -- kilometers**2
   subtype KILOMETERS_PER_SECOND is REAL;
   subtype KILOMETERS_PER_SECOND_SQ is REAL;  -- km/sec**2

   subtype METERS is REAL;

   subtype NM is REAL;        -- Newton x meters (measure of torque)
   subtype NMS is REAL;       -- Newtons x meters x seconds

   subtype RPM is REAL;               -- revolutions per minute


   --*****************************************************************
   --*****************************************************************
   -- Constant definitions
   --*****************************************************************
   --*****************************************************************

   PI : constant REAL := Ada.Numerics.PI;
   TWO_PI : constant REAL := 2.0 * PI;
   HALF_PI : constant REAL := PI / 2.0;

   DEGREES_TO_RADIANS : constant REAL := PI / 180.0;
   RADIANS_TO_DEGREES : constant REAL := 180.0 / PI;

   METERS_TO_KM : constant REAL := 0.001;
   KM_TO_METERS : constant REAL := 1000.0;


end Global_Defs;
Comment 1 Eric Botcazou 2005-01-02 11:30:55 UTC
Confirmed, a regression from 3.3.2 present on 3.4 branch only.
Comment 2 Eric Botcazou 2005-01-02 11:32:11 UTC
Investigating.
Comment 3 Eric Botcazou 2005-01-02 12:07:16 UTC
The problem comes from the address representation clauses:

   Parameter_Table      : PARAMETER_TABLE_TYPE;
   for Parameter_Table'Address use Full_Parameter_Table.Element'Address;

   Parameter_Byte_Table : PARAMETER_BYTES_TABLE_TYPE;
   for Parameter_Byte_Table'Address use Parameter_Table'Address;

With -fPIC, the addresses are not compile-time constants anymore so the
elaboration must be performed slightly differently.
Comment 4 Eric Botcazou 2005-01-25 13:07:02 UTC
Recategorizing.
Comment 5 Eric Botcazou 2005-09-06 08:24:00 UTC
Not really working on this.
Comment 6 ddavenpo 2005-09-06 14:07:03 UTC
Subject: Re:  [3.4 Regression] ICE with -fPIC

No kidding.

On Sep 6, 2005, at 2:24 AM, ebotcazou at gcc dot gnu dot org wrote:

>
> ------- Additional Comments From ebotcazou at gcc dot gnu dot org   
> 2005-09-06 08:24 -------
> Not really working on this.
>
>
> --  
>            What    |Removed                     |Added
> ----------------------------------------------------------------------- 
> -----
>                  CC|                            |ebotcazou at gcc dot  
> gnu dot
>                    |                            |org
>          AssignedTo|ebotcazou at gcc dot gnu dot|unassigned at gcc dot  
> gnu
>                    |org                         |dot org
>              Status|ASSIGNED                    |NEW
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19183
>
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.

Comment 7 Eric Botcazou 2005-09-06 15:53:37 UTC
> No kidding.

I guess you can probably refrain from posting such a comment.  I think it should
be possible to work around the problem by using renaming constructs.
Comment 8 Gabriel Dos Reis 2006-02-28 09:50:56 UTC
won't fix for 3.4.6