diff options
author | hainque <hainque@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-06-01 14:42:56 +0000 |
---|---|---|
committer | hainque <hainque@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-06-01 14:42:56 +0000 |
commit | 34a6a65d51c6601cafffe021ccb736663b96fd95 (patch) | |
tree | 2fb071a57ee2fbe016eadc8f563a7c7f8a70a306 /gcc/testsuite/gnat.dg/oconst3.adb | |
parent | 997988ca1eb43eb6672a5c86199f35b860ee4d5f (diff) | |
download | gcc-34a6a65d51c6601cafffe021ccb736663b96fd95.tar.gz |
* tree.h (CONSTRUCTOR_BITFIELD_P): True if NODE, a FIELD_DECL, is
to be processed as a bitfield for constructor output purposes.
* output.h (initializer_constant_valid_for_bitfield_p): Declare
new function.
* varasm.c (oc_local_state): New type, output_constructor
local state to support communication with helpers.
(oc_outer_state): New type, output_constructor outer state of
relevance in recursive calls.
(output_constructor_array_range): New output_constructor helper,
extracted code for an array range element.
(output_constructor_regular_field): New output_constructor helper,
extracted code for an element that is not a bitfield.
(output_constructor_bitfield): New output_constructor helper,
extracted code for a bitfield element. Accept an OUTER state
argument for recursive processing. Recurse on record or array
CONSTRUCTOR values, possibly past noop conversions.
(initializer_constant_valid_for_bitfield_p): New predicate. Whether
VALUE is a valid constant-valued expression for use in a static
bit-field initializer.
(output_constructor): Rework to use helpers. Accept and honor an
OUTER state argument for recursive calls. Return total size. Be
prepared for nested constructors initializing bitfields.
(output_constant): Feed OUTER in calls to output_constructor.
ada/
* gcc-interface/utils2.c (gnat_build_constructor): Factor
out code. Use initializer_constant_valid_for_bitfield_p and
CONSTRUCTOR_BITFIELD_P for bit-fields.
testsuite/
* gnat.dg/oconst[1-6].ad[bs]: New tests. Also support for ...
* gnat.dg/test_oconst.adb: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148045 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gnat.dg/oconst3.adb')
-rw-r--r-- | gcc/testsuite/gnat.dg/oconst3.adb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/testsuite/gnat.dg/oconst3.adb b/gcc/testsuite/gnat.dg/oconst3.adb new file mode 100644 index 00000000000..c9a94d4f491 --- /dev/null +++ b/gcc/testsuite/gnat.dg/oconst3.adb @@ -0,0 +1,16 @@ +-- { dg-do compile } +-- { dg-final { scan-assembler-not "elabs" } } + +package body OCONST3 is + + procedure check (arg : R) is + begin + if arg.u /= 1 + or else arg.f /= one + or else arg.b.i1 /= 3 + then + raise Program_Error; + end if; + end; + +end; |