From 88d24a099faa4dd225df68408663a74e11214f2d Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 9 Jan 2015 13:26:26 +0000 Subject: [PATCH] typeof-2.c: Add checks for non-atomic types. gcc/testsuite/gcc.dg/typeof-2.c gcc/testsuite/ChangeLog * gcc.dg/typeof-2.c: Add checks for non-atomic types. From-SVN: r219381 --- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.dg/typeof-2.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c962149b1bf..a529f192059 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-01-09 Sebastian Huber + + * gcc.dg/typeof-2.c: Add checks for non-atomic types. + 2015-01-09 Richard Biener PR tree-optimization/64410 diff --git a/gcc/testsuite/gcc.dg/typeof-2.c b/gcc/testsuite/gcc.dg/typeof-2.c index e9169003a9b..21ef5b0b865 100644 --- a/gcc/testsuite/gcc.dg/typeof-2.c +++ b/gcc/testsuite/gcc.dg/typeof-2.c @@ -2,6 +2,8 @@ /* { dg-do compile } */ /* { dg-options "-std=c11" } */ +/* Check that the qualifiers are discarded for atomic types. */ + extern int i; extern int * p; @@ -26,3 +28,32 @@ void f(void) __auto_type ari = ri; int **pari = &ari; } + +/* Check that the qualifiers are preserved for non-atomic types. */ + +extern int const j; + +extern int volatile k; + +extern int * restrict q; + +extern int const nci; +extern __typeof (nci) j; + +extern int volatile nvi; +extern __typeof (nvi) k; + +extern int * restrict nri; +extern __typeof (nri) q; + +void g(void) +{ + __auto_type aci = nci; + int const *paci = &aci; + + __auto_type avi = nvi; + int volatile *pavi = &avi; + + __auto_type ari = nri; + int * restrict *pari = &ari; +} -- 2.30.2