From: Arnaud Charlet Date: Thu, 29 Apr 2004 15:24:56 +0000 (+0200) Subject: [multiple changes] X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d935a36e27c5a15e05cabdc6b6e9b6d68538a14f;p=gcc.git [multiple changes] 2004-04-29 Ed Schonberg * checks.adb (Enable_Range_Check): If the prefix of an index component is an access to an unconstrained array, perform check unconditionally. 2004-04-29 Richard Kenner * decl.c (gnat_to_gnu_field): Also call make_packable_type if Component_Clause. 2004-04-29 Olivier Hainque * init.c (__gnat_install_handler, __gnat_error_handler): Remove alternate stack setting. There was no support for the tasking cases and the changes eventually caused a number of side-effect failures in the non-tasking case too. 2004-04-29 Eric Botcazou lang-specs.h: Redirect output to /dev/null if -gnatc or -gnatz or -gnats is passed. 2004-04-29 Vincent Celier * make.adb (Gnatmake): Increase max size of argument array for gnatbind for the potential addition of -F. If there are Stand-Alone Library projects, invoke gnatbind with -F to be sure that elaboration flags will be checked. * switch-c.adb: Correct call to Scan_Pos for -gnateI 2004-04-29 Thomas Quinot * sem_warn.adb (Check_References): Move ' may be null' warning out of under Warn_On_No_Value_Assigned. 2004-04-29 Ed Falis * gnat_ugn.texi: Fixed texi error 2004-04-29 Robert Dewar * sem_ch4.adb (Remove_Abstract_Operations): Unconditionally remove abstract operations if they come from predefined files. * gnat_rm.texi: Fix bad doc for pragma Elaboration_Checks (should be Dynamic, not RM). * s-addope.adb: Correct obvious error in mod function From-SVN: r81289 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index dd6d33f9d06..5daf8d435c0 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,61 @@ +2004-04-29 Ed Schonberg + + * checks.adb (Enable_Range_Check): If the prefix of an index component + is an access to an unconstrained array, perform check unconditionally. + +2004-04-29 Richard Kenner + + * decl.c (gnat_to_gnu_field): Also call make_packable_type if + Component_Clause. + +2004-04-29 Olivier Hainque + + * init.c (__gnat_install_handler, __gnat_error_handler): Remove + alternate stack setting. There was no support for the tasking cases + and the changes eventually caused a number of side-effect failures in + the non-tasking case too. + +2004-04-29 Eric Botcazou + + lang-specs.h: Redirect output to /dev/null if -gnatc or -gnatz or + -gnats is passed. + +2004-04-29 Vincent Celier + + * make.adb (Gnatmake): Increase max size of argument array for + gnatbind for the potential addition of -F. + If there are Stand-Alone Library projects, invoke gnatbind with -F to + be sure that elaboration flags will be checked. + + * switch-c.adb: Correct call to Scan_Pos for -gnateI + +2004-04-29 Thomas Quinot + + * sem_warn.adb (Check_References): Move ' may be + null' warning out of under Warn_On_No_Value_Assigned. + +2004-04-29 Ed Falis + + * gnat_ugn.texi: Fixed texi error + +2004-04-29 Robert Dewar + + * sem_ch4.adb (Remove_Abstract_Operations): Unconditionally remove + abstract operations if they come from predefined files. + + * gnat_rm.texi: Fix bad doc for pragma Elaboration_Checks (should be + Dynamic, not RM). + + * s-addope.adb: Correct obvious error in mod function + +2004-04-28 Andrew W. Reynolds + + * Makefile.in: Add target pairs for powerpc darwin* + tasking support. + + * a-intnam-darwin.ads, s-osinte-darwin.adb, + s-osinte-darwin.ads, system-darwin-ppc.ads: New files. + 2004-04-28 Ulrich Weigand * Makefile.in: Add target macro definitions for s390*-linux*. diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb index aaad1a488c3..059730067e0 100644 --- a/gcc/ada/checks.adb +++ b/gcc/ada/checks.adb @@ -3379,6 +3379,16 @@ package body Checks is if Is_Access_Type (Atyp) then Atyp := Designated_Type (Atyp); + + -- If the prefix is an access to an unconstrained array, + -- perform check unconditionally: it depends on the bounds + -- of an object and we cannot currently recognize whether + -- the test may be redundant. + + if not Is_Constrained (Atyp) then + Set_Do_Range_Check (N, True); + return; + end if; end if; Indx := First_Index (Atyp); diff --git a/gcc/ada/decl.c b/gcc/ada/decl.c index 73c35c511dc..92e1342feb9 100644 --- a/gcc/ada/decl.c +++ b/gcc/ada/decl.c @@ -4998,11 +4998,11 @@ gnat_to_gnu_field (Entity_Id gnat_field, && TYPE_LEFT_JUSTIFIED_MODULAR_P (gnu_field_type)) gnu_field_type = TREE_TYPE (TYPE_FIELDS (gnu_field_type)); - /* If we are packing this record or we have a specified size that's - smaller than that of the field type and the field type is also a record - that's BLKmode and with a small constant size, see if we can get a - better form of the type that allows more packing. If we can, show - a size was specified for it if there wasn't one so we know to + /* If we are packing this record, have a specified size that's smaller than + that of the field type, or a position is specified, and the field type + is also a record that's BLKmode and with a small constant size, see if + we can get a better form of the type that allows more packing. If we + can, show a size was specified for it if there wasn't one so we know to make this a bitfield and avoid making things wider. */ if (TREE_CODE (gnu_field_type) == RECORD_TYPE && TYPE_MODE (gnu_field_type) == BLKmode @@ -5010,7 +5010,8 @@ gnat_to_gnu_field (Entity_Id gnat_field, && compare_tree_int (TYPE_SIZE (gnu_field_type), BIGGEST_ALIGNMENT) <= 0 && (packed || (gnu_size != 0 && tree_int_cst_lt (gnu_size, - TYPE_SIZE (gnu_field_type))))) + TYPE_SIZE (gnu_field_type))) + || Present (Component_Clause (gnat_field)))) { gnu_field_type = make_packable_type (gnu_field_type); diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index 8dbc0d36c1a..fad86e184bc 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -1308,16 +1308,17 @@ debug procedures in the middle of declarations. Syntax: @smallexample @c ada -pragma Elaboration_Checks (RM | Static); +pragma Elaboration_Checks (Dynamic | Static); @end smallexample @noindent This is a configuration pragma that provides control over the elaboration model used by the compilation affected by the -pragma. If the parameter is RM, then the dynamic elaboration +pragma. If the parameter is @code{Dynamic}, +then the dynamic elaboration model described in the Ada Reference Manual is used, as though the @code{-gnatE} switch had been specified on the command -line. If the parameter is Static, then the default GNAT static +line. If the parameter is @code{Static}, then the default GNAT static model is used. This configuration pragma overrides the setting of the command line. For full details on the elaboration models used by the GNAT compiler, see section ``Elaboration Order diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index 06dd07a16ef..2b908fb2e8b 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -6935,7 +6935,7 @@ See also the packages @code{GNAT.Traceback} and @ifclear vms Note that on x86 ports, you must not use @option{-fomit-frame-pointer} @code{gcc} option. -@end ifclear vms +@end ifclear @item ^-F^/FORCE_ELABS_FLAGS^ @cindex @option{^-F^/FORCE_ELABS_FLAGS^} (@command{gnatbind}) diff --git a/gcc/ada/init.c b/gcc/ada/init.c index efc1a25fc2a..fd25d0d7b0d 100644 --- a/gcc/ada/init.c +++ b/gcc/ada/init.c @@ -386,7 +386,6 @@ __gnat_initialize (void) exclude this case in the above test. */ #include -#include #include static void __gnat_error_handler (int, siginfo_t *, struct sigcontext *); @@ -404,7 +403,6 @@ __gnat_error_handler (int sig, siginfo_t *sip, struct sigcontext *context) static int recurse = 0; struct sigcontext *mstate; const char *msg; - jmp_buf handler_jmpbuf; /* If this was an explicit signal from a "kill", just resignal it. */ if (SI_FROMUSER (sip)) @@ -414,43 +412,6 @@ __gnat_error_handler (int sig, siginfo_t *sip, struct sigcontext *context) } /* Otherwise, treat it as something we handle. */ - - /* We are now going to raise the exception corresponding to the signal we - caught, which may eventually end up resuming the application code if the - exception is handled. - - When the exception is handled, merely arranging for the *exception* - handler's context (stack pointer, program counter, other registers, ...) - to be installed is *not* enough to let the kernel think we've left the - *signal* handler. This has annoying implications if an alternate stack - has been setup for this *signal* handler, because the kernel thinks we - are still running on that alternate stack even after the jump, which - causes trouble at least as soon as another signal is raised. - - We deal with this by forcing a "local" longjmp within the signal handler - below, forcing the "on alternate stack" indication to be reset (kernel - wise) on the way. If no alternate stack has been setup, this should be a - neutral operation. Otherwise, we will be in a delicate situation for a - short while because we are going to run the exception propagation code - within the alternate stack area (that is, with the stack pointer inside - the alternate stack bounds), but with the corresponding flag off from the - kernel's standpoint. We expect this to be ok as long as the propagation - code does not trigger a signal itself, which is expected. - - ??? A better approach would be to at least delay this operation until the - last second, that is, until just before we jump to the exception handler, - if any. */ - - if (setjmp (handler_jmpbuf) == 0) - { -#define JB_ONSIGSTK 0 - - /* Arrange for the "on alternate stack" flag to be reset. See the - comments around "jmp_buf offsets" in /usr/include/setjmp.h. */ - handler_jmpbuf [JB_ONSIGSTK] = 0; - longjmp (handler_jmpbuf, 1); - } - switch (sig) { case SIGSEGV: @@ -510,36 +471,12 @@ __gnat_install_handler (void) { struct sigaction act; - /* stack-checking on this platform is performed by the back-end and conforms - to what the ABI *mandates* (DEC OSF/1 Calling standard for AXP systems, - chapter 6: Stack Limits in Multihtreaded Execution Environments). This - does not include a "stack reserve" region, so nothing guarantees that - enough room remains on the current stack to propagate an exception when - a stack-overflow is signaled. We deal with this by requesting the use of - an alternate stack region for signal handlers. - - ??? The actual use of this alternate region depends on the act.sa_flags - including SA_ONSTACK below. Care should be taken to update s-intman if - we want this to happen for tasks also. */ - - static char sig_stack [8*1024]; - /* 8K is a mininum to be able to propagate an exception using the GCC/ZCX - scheme. */ - - struct sigaltstack ss; - - ss.ss_sp = (void *) sig_stack; - ss.ss_size = sizeof (sig_stack); - ss.ss_flags = 0; - - sigaltstack (&ss, 0); - /* Setup signal handler to map synchronous signals to appropriate exceptions. Make sure that the handler isn't interrupted by another signal that might cause a scheduling event! */ act.sa_handler = (void (*) (int)) __gnat_error_handler; - act.sa_flags = SA_ONSTACK | SA_RESTART | SA_NODEFER | SA_SIGINFO; + act.sa_flags = SA_RESTART | SA_NODEFER | SA_SIGINFO; sigemptyset (&act.sa_mask); /* Do not install handlers if interrupt state is "System" */ diff --git a/gcc/ada/lang-specs.h b/gcc/ada/lang-specs.h index c1ad1ae36f8..46a862a7d59 100644 --- a/gcc/ada/lang-specs.h +++ b/gcc/ada/lang-specs.h @@ -6,7 +6,7 @@ * * * C Header File * * * - * Copyright (C) 1992-2003 Free Software Foundation, Inc. * + * Copyright (C) 1992-2004 Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * @@ -40,4 +40,5 @@ %{g*} %{O*} %{W*} %{w} %{p} %{pg:-p} %{m*} %{a} %{f*} %{d*}\ %{!S:%{o*:%w%*-gnatO}} \ %i %{S:%W{o*}%{!o*:-o %b.s}} \ + %{!S:%{gnatc*|gnatz*|gnats*: -o %j}} \ %{!gnatc*:%{!gnatz*:%{!gnats*:%(invoke_as)}}}", 0, 0, 0}, diff --git a/gcc/ada/make.adb b/gcc/ada/make.adb index 264527ed250..149c1fc4112 100644 --- a/gcc/ada/make.adb +++ b/gcc/ada/make.adb @@ -344,6 +344,7 @@ package body Make is -- These flags are reset to True for each invokation of procedure Gnatmake. Shared_String : aliased String := "-shared"; + Force_Elab_Flags_String : aliased String := "-F"; No_Shared_Switch : aliased Argument_List := (1 .. 0 => null); Shared_Switch : aliased Argument_List := (1 => Shared_String'Access); @@ -3323,6 +3324,8 @@ package body Make is -- The current working directory, used to modify some relative path -- switches on the command line when a project file is used. + There_Are_Stand_Alone_Libraries : Boolean := False; + begin Gnatmake_Called := True; @@ -4428,6 +4431,10 @@ package body Make is for Proj1 in Projects.First .. Projects.Last loop + if Projects.Table (Proj1).Standalone_Library then + There_Are_Stand_Alone_Libraries := True; + end if; + if Projects.Table (Proj1).Library and then not Projects.Table (Proj1).Flag1 then @@ -4643,7 +4650,7 @@ package body Make is if Do_Bind_Step then Bind_Step : declare Args : Argument_List - (Binder_Switches.First .. Binder_Switches.Last + 1); + (Binder_Switches.First .. Binder_Switches.Last + 2); -- The arguments for the invocation of gnatbind Last_Arg : Natural := Binder_Switches.Last; @@ -4704,6 +4711,11 @@ package body Make is Args (J) := Binder_Switches.Table (J); end loop; + if There_Are_Stand_Alone_Libraries then + Last_Arg := Last_Arg + 1; + Args (Last_Arg) := Force_Elab_Flags_String'Access; + end if; + if Main_Project /= No_Project then -- Put all the source directories in ADA_INCLUDE_PATH, diff --git a/gcc/ada/s-addope.adb b/gcc/ada/s-addope.adb index 5a388131598..2b360f1c96f 100644 --- a/gcc/ada/s-addope.adb +++ b/gcc/ada/s-addope.adb @@ -81,7 +81,7 @@ package body System.Address_Operations is function ModA (Left, Right : Address) return Address is begin - return A (I (Left) and I (Right)); + return A (I (Left) mod I (Right)); end ModA; --------- diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index cce3e09c7c8..42ebaef2786 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -30,7 +30,9 @@ with Debug; use Debug; with Einfo; use Einfo; with Errout; use Errout; with Exp_Util; use Exp_Util; +with Fname; use Fname; with Itypes; use Itypes; +with Lib; use Lib; with Lib.Xref; use Lib.Xref; with Namet; use Namet; with Nlists; use Nlists; @@ -4344,22 +4346,32 @@ package body Sem_Ch4 is -------------------------------- procedure Remove_Abstract_Operations (N : Node_Id) is - I : Interp_Index; - It : Interp; - Abstract_Op : Entity_Id := Empty; + I : Interp_Index; + It : Interp; + Abstract_Op : Entity_Id := Empty; -- AI-310: If overloaded, remove abstract non-dispatching - -- operations. + -- operations. We activate this if either extensions are + -- enabled, or if the abstract operation in question comes + -- from a predefined file. This latter test allows us to + -- use abstract to make operations invisible to users. In + -- particular, if type Address is non-private and abstract + -- subprograms are used to hide its operators, they will be + -- truly hidden. begin - if Extensions_Allowed - and then Is_Overloaded (N) - then + if Is_Overloaded (N) then Get_First_Interp (N, I, It); + while Present (It.Nam) loop if not Is_Type (It.Nam) and then Is_Abstract (It.Nam) and then not Is_Dispatching_Operation (It.Nam) + and then + (Extensions_Allowed + or else Is_Predefined_File_Name + (Unit_File_Name (Get_Source_Unit (It.Nam)))) + then Abstract_Op := It.Nam; Remove_Interp (I); diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb index 187fc9bf389..970213e7905 100644 --- a/gcc/ada/sem_warn.adb +++ b/gcc/ada/sem_warn.adb @@ -384,8 +384,7 @@ package body Sem_Warn is then null; - elsif Warn_On_No_Value_Assigned - and then Present (UR) + elsif Present (UR) and then Is_Access_Type (Etype (E1)) then diff --git a/gcc/ada/switch-c.adb b/gcc/ada/switch-c.adb index df91201a7ae..a378f209d9b 100644 --- a/gcc/ada/switch-c.adb +++ b/gcc/ada/switch-c.adb @@ -386,7 +386,7 @@ package body Switch.C is when 'I' => Ptr := Ptr + 1; - Scan_Pos (Switch_Chars, 999, Ptr, Multiple_Unit_Index); + Scan_Pos (Switch_Chars, Max, Ptr, Multiple_Unit_Index); -- -gnatem (mapping file)