Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / gcc.c-torture / execute / builtins / printf.c
blobe493f90b7cd452c9fb57f1b5537c63013d83fee9
1 /* Copyright (C) 2000 Free Software Foundation.
3 Ensure all expected transformations of builtin printf occur and
4 that we honor side effects in the arguments.
6 Written by Kaveh R. Ghazi, 12/4/2000. */
8 extern int printf (const char *, ...);
9 extern int printf_unlocked (const char *, ...);
10 extern void abort(void);
12 void
13 main_test (void)
15 const char *const s1 = "hello world";
16 const char *const s2[] = { s1, 0 }, *const*s3;
18 printf ("%s\n", "hello");
19 printf ("%s\n", *s2);
20 s3 = s2;
21 printf ("%s\n", *s3++);
22 if (s3 != s2+1 || *s3 != 0)
23 abort();
25 printf ("%c", '\n');
26 printf ("%c", **s2);
27 s3 = s2;
28 printf ("%c", **s3++);
29 if (s3 != s2+1 || *s3 != 0)
30 abort();
32 printf ("");
33 printf ("%s", "");
34 printf ("\n");
35 printf ("%s", "\n");
36 printf ("hello world\n");
37 printf ("%s", "hello world\n");
39 /* Test at least one instance of the __builtin_ style. We do this
40 to ensure that it works and that the prototype is correct. */
41 __builtin_printf ("%s\n", "hello");
42 /* These builtin stubs are called by __builtin_printf, ensure their
43 prototypes are set correctly too. */
44 __builtin_putchar ('\n');
45 __builtin_puts ("hello");
46 /* Check the unlocked style, these evaluate to nothing to avoid
47 problems on systems without the unlocked functions. */
48 printf_unlocked ("");
49 __builtin_printf_unlocked ("");
50 printf_unlocked ("%s", "");
51 __builtin_printf_unlocked ("%s", "");