Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/c-c++-common/pr51628-28.c @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | |
children |
line wrap: on
line source
/* PR c/51628. */ /* { dg-do compile } */ /* { dg-options "-O" } */ struct A { int i; } __attribute__ ((packed)); int * foo3 (struct A *p1, int *q1, int *q2, struct A *p2) { return (q1 ? &p1->i /* { dg-warning "may result in an unaligned pointer value" "" { target *-*-* } .-1 } */ : (q2 ? &p2->i : q2)); /* { dg-warning "may result in an unaligned pointer value" "" { target *-*-* } .-1 } */ } int* foo4 (struct A *p1, int **q1, int *q2, int *q3, struct A *p2) { return (q1 ? (*q1 = q2, &p1->i) /* { dg-warning "may result in an unaligned pointer value" "" { target *-*-* } .-1 } */ : (q2 ? (*q1 = &p1->i, /* { dg-warning "may result in an unaligned pointer value" "" { target *-*-* } .-1 } */ *q2 = 2, &p2->i) /* { dg-warning "may result in an unaligned pointer value" "" { target *-*-* } .-1 } */ : q2)); }