diff options
author | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-01-29 16:12:45 +0000 |
---|---|---|
committer | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-01-29 16:12:45 +0000 |
commit | aebc8537fd59ab4cd6e0cea7b784acdf17b03745 (patch) | |
tree | 146eb63899ed165bd17ec164fc3ef99342b7f13b /gcc/testsuite/gcc.dg/Wwrite-strings-1.c | |
parent | 5c906e8eb80e9a71be38d41ea594871bad074efb (diff) | |
download | gcc-aebc8537fd59ab4cd6e0cea7b784acdf17b03745.tar.gz |
* c-common.c (fix_string_type): Just use c_build_qualified_type to
build string type.
(c_build_qualified_type): Build qualified array types with
TYPE_MAIN_VARIANT pointing to corresponding unqualified type.
* c-decl.c (c_make_fname_decl): Build unqualified array type
before qualified type.
(grokdeclarator): Use TYPE_MAIN_VARIANT of typedef type if element
type is qualified, not just if type itself is. Don't apply
qualifiers to array type when declarator is processed. Apply
qualifiers to field type whether or not it is an array type.
Don't handle array types specially for applying qualifiers to
variables.
* c-typeck.c (composite_type): Build unqualified element type and
array type when forming composite of array types.
(common_pointer_type, comptypes, comp_target_types,
type_lists_compatible_p, build_indirect_ref, build_array_ref,
convert_for_assignment): Don't apply TYPE_MAIN_VARIANT to array
types.
(type_lists_compatible_p): Cache TREE_VALUE (args1) and TREE_VALUE
(args2) in variables a1 and a2.
testsuite:
* gcc.dg/Wwrite-strings-1.c, gcc.dg/array-quals-2.c,
gcc.dg/lvalue-3.c: New tests.
* gcc.dg/concat.c: Update expected messages.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@94411 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/Wwrite-strings-1.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/Wwrite-strings-1.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/Wwrite-strings-1.c b/gcc/testsuite/gcc.dg/Wwrite-strings-1.c new file mode 100644 index 00000000000..9270e8f8712 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wwrite-strings-1.c @@ -0,0 +1,8 @@ +/* Test pointer initialization and dereference don't lose qualifiers + on array types. This test wrongly failed to diagnose the loss of + const. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-Wwrite-strings" } */ +typedef char T[1]; +T *p = &""; /* { dg-warning "warning: initialization from incompatible pointer type" } */ |