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] Guard against cascaded error when processing deferred config pragmas


Some configuration pragmas require the presence of a compilation unit context
to be processed. Their analysis is deferred until after the main unit
has been analyzed. However, if that analysis fails for any reason, then the
context may not be correctly established, and the deferred config pragmas
must not be analyzed, because this could cause a compiler crash.

Using a compiler with assertions enabled, the following compilation must
produce the indicated error message (and no bug box):

$ gcc -c illeg.adb
illeg.adb:2:04: declaration expected

package Illeg is
   procedure Proc;
end Illeg;
package body Illeg is
   illegal;
end Illeg;

--  gnat.adc:
pragma Initialize_Scalars;
pragma Restrictions (No_Abort_Statements);
pragma Restrictions (Max_Asynchronous_Select_Nesting => 0);
pragma Restrictions (No_Asynchronous_Control);
pragma Restrictions (No_Dynamic_Priorities);
pragma Interrupt_State (Name => SIGABRT, State => SYSTEM);
pragma Interrupt_State (Name => SIGTERM, State => SYSTEM);
pragma Interrupt_State (Name => SIGPIPE, State => SYSTEM);

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

2012-08-06  Thomas Quinot  <quinot@adacore.com>

	* frontend.adb: Do not attempt to process deferred configuration
	pragmas if the main unit failed to load, to avoid cascaded
	inconsistencies that can lead to a compiler crash.

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]