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]

[Ada] Compiler crash with Initialize_Scalars


If pragma Initialize_Scalars applies, then in certain obscure cases the
compiler would crash. In particular, a private type whose full type is an
array, and then another private type whose full type is derived from the first
private type, and then an object declared of that second private type.
This patch fixes the bug.

The following test should compile quietly.

gcc -c q.adb -gnatws

with Interrupt_Management;

procedure Q is

  Mask : Interrupt_Management.Interrupt_Mask;

begin
  null;
end;
package OS_Interface is

   type sigset_t is private;

private

   type unsigned_char is mod 256;
   type sigset_t is array (0 .. 127) of unsigned_char;

end OS_Interface;
with OS_Interface;

package Interrupt_Management is

   type Interrupt_Mask is private;

private
   type Interrupt_Mask is new OS_Interface.sigset_t;

end Interrupt_Management;

Tested on x86_64-pc-linux-gnu, committed on trunk

2010-10-26  Bob Duff  <duff@adacore.com>

	* sem_res.adb (Resolve_Actuals): In case of certain
	internally-generated type conversions (created by OK_Convert_To, so the
	Conversion_OK flag is set), avoid fetching the component type when it's
	not really an array type, but a private type completed by an array type.

Attachment: difs
Description: Text document


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