Skip several analyzer socket tests on hppa*-*-hpux*
[official-gcc.git] / gcc / testsuite / c-c++-common / analyzer / pr94851-1.c
blob7407efa21e76d125837a142f651b4fffe49e4b0f
1 /* { dg-skip-if "" { powerpc*-*-aix* } } */
2 /* { dg-additional-options "-O2" } */
4 #include <stdio.h>
5 #include <stdlib.h>
7 typedef struct AMARK {
8 struct AMARK *m_next;
9 char m_name;
10 } AMARK;
12 struct buf {
13 AMARK *b_amark;
16 struct buf *curbp;
18 int pamark(void) {
19 int c;
20 AMARK *p = curbp->b_amark;
21 AMARK *last = curbp->b_amark;
23 c = getchar();
25 while (p != (AMARK *)NULL && p->m_name != (char)c) {
26 last = p;
27 p = p->m_next;
30 if (p != (AMARK *)NULL) {
31 printf("over writing mark %c\n", c);
32 } else {
33 if ((p = (AMARK *)malloc(sizeof(AMARK))) == (AMARK *)NULL)
34 return 0;
36 p->m_next = (AMARK *)NULL;
38 if (curbp->b_amark == (AMARK *)NULL)
39 curbp->b_amark = p;
40 else
41 last->m_next = p;
44 p->m_name = (char)c; /* { dg-bogus "leak of 'p'" "bogus leak" } */
46 return 1;