re PR c/39464 (Attribute may_alias causes invalid warning)
PR c/39464 * c-typeck.c (convert_for_assignment): For -Wpointer-sign warning require that both c_common_unsigned_type as well as c_common_signed_type is the same for both mvl and mvr types. * gcc.dg/pr39464.c: New test. From-SVN: r194630
This commit is contained in:
parent
7b8c7831a2
commit
1ac13b9c05
1 changed files with 19 additions and 0 deletions
19
gcc/testsuite/gcc.dg/pr39464.c
Normal file
19
gcc/testsuite/gcc.dg/pr39464.c
Normal file
|
@ -0,0 +1,19 @@
|
|||
/* PR c/39464 */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-Wall" } */
|
||||
|
||||
typedef int T __attribute__((may_alias));
|
||||
typedef unsigned int U __attribute__((may_alias));
|
||||
|
||||
void
|
||||
foo (void *p)
|
||||
{
|
||||
T *a = (int *) p; /* { dg-warning "initialization from incompatible pointer type" } */
|
||||
int *b = (T *) p; /* { dg-warning "initialization from incompatible pointer type" } */
|
||||
U *c = (unsigned int *) p; /* { dg-warning "initialization from incompatible pointer type" } */
|
||||
unsigned int *d = (U *) p; /* { dg-warning "initialization from incompatible pointer type" } */
|
||||
(void) a;
|
||||
(void) b;
|
||||
(void) c;
|
||||
(void) d;
|
||||
}
|
Loading…
Add table
Reference in a new issue