[multiple changes]

2012-02-17  Ed Schonberg  <schonberg@adacore.com>

	* exp_ch6.adb (Legal_Copy): If layout is not
	determined in the front-end, do not emit error message when
	by-reference actual is potentially unaligned.
	* gcc-interface/decl.c (gnat_to_gnu_field): Better error message for
	illegal representation clause on tagged or aliased component, or on
	by-reference type with forced alignment.

2012-02-17  Nicolas Roche  <roche@adacore.com>

	* gcc-interface/Makefile.in: Ensure FORCE_DEBUG_ADAFLAGS variables is
	propagated by gnatlib-sjlj and gnatlib-zcx targets.
	* gcc-interface/Make-lang.in: Update dependencies.

2012-02-17  Thomas Quinot  <quinot@adacore.com>

	* sem_ch12.adb (Analyze_Package_Instantiation): For an
	instantiation in an RCI library unit, omit the instance body
	if the RCI library unit is the instance itself (E.2.3(18)),
	but include the body if the instantiation is within the RCI
	declaration (12.3(12)).

From-SVN: r184343
This commit is contained in:
Arnaud Charlet 2012-02-17 15:26:20 +01:00
parent acf49e88aa
commit f45ccc7c0d
6 changed files with 931 additions and 862 deletions

View file

@ -1,3 +1,26 @@
2012-02-17 Ed Schonberg <schonberg@adacore.com>
* exp_ch6.adb (Legal_Copy): If layout is not
determined in the front-end, do not emit error message when
by-reference actual is potentially unaligned.
* gcc-interface/decl.c (gnat_to_gnu_field): Better error message for
illegal representation clause on tagged or aliased component, or on
by-reference type with forced alignment.
2012-02-17 Nicolas Roche <roche@adacore.com>
* gcc-interface/Makefile.in: Ensure FORCE_DEBUG_ADAFLAGS variables is
propagated by gnatlib-sjlj and gnatlib-zcx targets.
* gcc-interface/Make-lang.in: Update dependencies.
2012-02-17 Thomas Quinot <quinot@adacore.com>
* sem_ch12.adb (Analyze_Package_Instantiation): For an
instantiation in an RCI library unit, omit the instance body
if the RCI library unit is the instance itself (E.2.3(18)),
but include the body if the instantiation is within the RCI
declaration (12.3(12)).
2012-02-17 Steve Baird <baird@adacore.com>
* sem_prag.adb (Analyze_PPC_In_Decl_Part): Pre'Class and

View file

@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
-- Copyright (C) 1992-2012, 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- --
@ -1417,8 +1417,18 @@ package body Exp_Ch6 is
-- representation clauses give the actual a misaligned address.
if Is_By_Reference_Type (Etype (Formal)) then
Error_Msg_N
("misaligned actual cannot be passed by reference", Actual);
-- If the front-end does not perform full type layout, the actual
-- may in fact be properly aligned but there is not enough front-end
-- information to determine this. In that case gigi will emit an
-- error if a copy is not legal, or generate the proper code.
-- For other backends we report the error now.
if Frontend_Layout_On_Target then
Error_Msg_N
("misaligned actual cannot be passed by reference", Actual);
end if;
return False;
-- For users of Starlet, we assume that the specification of by-
@ -6120,6 +6130,7 @@ package body Exp_Ch6 is
begin
Set_Has_Completion (Subp, False);
-- Set_Has_Delayed_Freeze (Subp);
Append_Freeze_Action (Subp, Bod);
-- The body now contains raise statements, so calls to it will

File diff suppressed because it is too large Load diff

View file

@ -2773,6 +2773,7 @@ gnatlib-sjlj:
GNATLIBFLAGS="$(GNATLIBFLAGS)" \
GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
FORCE_DEBUG_ADAFLAGS="$(FORCE_DEBUG_ADAFLAGS)" \
MULTISUBDIR="$(MULTISUBDIR)" \
THREAD_KIND="$(THREAD_KIND)" \
PICFLAG_FOR_TARGET="$(PICFLAG_FOR_TARGET)" gnatlib
@ -2787,6 +2788,7 @@ gnatlib-zcx:
GNATLIBFLAGS="$(GNATLIBFLAGS)" \
GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
FORCE_DEBUG_ADAFLAGS="$(FORCE_DEBUG_ADAFLAGS)" \
MULTISUBDIR="$(MULTISUBDIR)" \
THREAD_KIND="$(THREAD_KIND)" \
PICFLAG_FOR_TARGET="$(PICFLAG_FOR_TARGET)" gnatlib

View file

@ -7032,10 +7032,10 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed,
TYPE_ALIGN (gnu_field_type));
else if (Strict_Alignment (gnat_field_type))
post_error_ne_num
("position of & with aliased or tagged components not multiple of ^ bits",
First_Bit (Component_Clause (gnat_field)), gnat_field,
TYPE_ALIGN (gnu_field_type));
post_error_ne
("position of & is not compatible with alignment required "
"by its components",
First_Bit (Component_Clause (gnat_field)), gnat_field);
else
gcc_unreachable ();
@ -7132,8 +7132,8 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed,
return gnu_field;
}
/* Return true if TYPE is a type with variable size, a padding type with a
field of variable size or is a record that has a field such a field. */
/* Return true if TYPE is a type with variable size or a padding type with a
field of variable size or a record that has a field with such a type. */
static bool
type_has_variable_size (tree type)

View file

@ -3704,18 +3704,37 @@ package body Sem_Ch12 is
end if;
end;
-- Note that we generate the instance body even when generating
-- calling stubs for an RCI unit: it may be required e.g. if it
-- provides stream attributes for some type used in the profile of a
-- remote subprogram. If the instantiation is within the visible part
-- of the RCI, then calling stubs for any relevant subprogram will
-- be inserted immediately after the subprogram declaration, and
-- will take precedence over the subsequent (original) body. (The
-- stub and original body will be complete homographs, but this is
-- permitted in an instance).
-- For RCI unit calling stubs, we omit the instance body if the
-- instance is the RCI library unit itself.
-- Could we do better and remove the original subprogram body in that
-- case???
-- However there is a special case for nested instances: in this case
-- we do generate the instance body, as it might be required, e.g.
-- because it provides stream attributes for some type used in the
-- profile of a remote subprogram. This is consistent with 12.3(12),
-- which indicates that the instance body occurs at the place of the
-- instantiation, and thus is part of the RCI declaration, which is
-- present on all client partitions (this is E.2.3(18)).
-- Note that AI12-0002 may make it illegal at some point to have
-- stream attributes defined in an RCI unit, in which case this
-- special case will become unnecessary. In the meantime, there
-- is known application code in production that depends on this
-- being possible, so we definitely cannot eliminate the body in
-- the case of nested instances for the time being.
-- When we generate a nested instance body, calling stubs for any
-- relevant subprogram will be be inserted immediately after the
-- subprogram declarations, and will take precedence over the
-- subsequent (original) body. (The stub and original body will be
-- complete homographs, but this is permitted in an instance).
-- (Could we do better and remove the original body???)
if Distribution_Stub_Mode = Generate_Caller_Stub_Body
and then Comes_From_Source (N)
and then Nkind (Parent (N)) = N_Compilation_Unit
then
Needs_Body := False;
end if;
if Needs_Body then