Home | History | Annotate | Line # | Download | only in lint1
gcc_builtin_alloca.c revision 1.1
      1 /*	$NetBSD: gcc_builtin_alloca.c,v 1.1 2021/12/06 23:20:26 rillig Exp $	*/
      2 # 3 "gcc_builtin_alloca.c"
      3 
      4 /*
      5  * Test for the GCC builtin functions __builtin_alloca*, which unlike most
      6  * other builtin functions return a pointer instead of int.
      7  *
      8  * https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
      9  */
     10 
     11 void
     12 example(void)
     13 {
     14 	/* expect+1: warning: illegal combination of pointer (pointer to char) and integer (int) [183] */
     15 	char *ptr = __builtin_alloca(8);
     16 	ptr[4] = '4';
     17 
     18 	/* expect+1: warning: illegal combination of pointer (pointer to char) and integer (int) [183] */
     19 	char *aligned_ptr = __builtin_alloca_with_align(8, 64);
     20 	aligned_ptr[0] = '\0';
     21 }
     22