https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61862

            Bug ID: 61862
           Summary: No -Wcast-align warning
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chengniansun at gmail dot com

GCC does not emit cast-align warning on the following code. Is this expected? 


$: cat t.c
int *f(char * c, int n) {
  return (int *)(c + 2);
}



$: clang-trunk -Wcast-align -c t.c
t.c:2:10: warning: cast from 'char *' to 'int *' increases required alignment
from 1 to 4 [-Wcast-align]
  return (int *)(c + 2);
         ^~~~~~~~~~~~~~
1 warning generated.
$: gcc-trunk -Wcast-align -c t.c
$:

Reply via email to