diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-06-24 18:15:36 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-06-24 18:15:36 +0000 |
commit | b2c48b2799d33cca7f44c437a4043ca4daa40c1f (patch) | |
tree | 1f4c859fa21f77b99e36f9bd2885a7fe48b8f631 /gcc/testsuite/gnat.dg/warn5.adb | |
parent | 95e0564c2bd9631d959778d55a3af5a65a4f4b1c (diff) | |
download | gcc-b2c48b2799d33cca7f44c437a4043ca4daa40c1f.tar.gz |
* utils2.c (known_alignment): Derive the alignment from pointed-to
types only if it is otherwise unknown.
<INTEGER_CST>: Tidy.
<MULT_EXPR>: Likewise.
<POINTER_PLUS_EXPR>: If the alignment of the offset is unknown, use
that of the base.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@137081 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gnat.dg/warn5.adb')
-rw-r--r-- | gcc/testsuite/gnat.dg/warn5.adb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc/testsuite/gnat.dg/warn5.adb b/gcc/testsuite/gnat.dg/warn5.adb new file mode 100644 index 00000000000..108bc594c0c --- /dev/null +++ b/gcc/testsuite/gnat.dg/warn5.adb @@ -0,0 +1,34 @@ +-- { dg-do compile } + +with System; +with Unchecked_Conversion; + +procedure Warn5 is + + type Digit_Type is range 0..15; + + type Frequency_Type is array( 1..12) of Digit_Type; + pragma Pack(Frequency_Type); + + type Element_Type is record + F : Frequency_Type; + end record; + + type Array_Type is array (Natural range <>) of Element_Type; + + type List_Type is record + A : Array_Type (0..1); + end record; + for List_Type'Alignment use 4; + + type Pointer_Type is access Element_Type; + function To_Ptr is new Unchecked_Conversion(System.Address, Pointer_Type); + + function Pointer (Pos : Natural; List : List_Type) return Pointer_Type is + begin + return To_Ptr(List.A(Pos)'Address); -- { dg-warning "source alignment" "" { target alpha*-*-* hppa*-*-* ia64-*-* mips*-*-* sparc*-*-* } } + end; + +begin + null; +end; |