IRA: Ignore debug insns for uses in split_live_ranges_for_shrink_wrap. [PR116179]
[official-gcc.git] / gcc / testsuite / c-c++-common / analyzer / deref-before-check-pr108455-1.c
blob5f2ca9669313035b713aa3fd18ab5bfac518b837
1 extern int could_fail_1 (void);
2 extern void *could_fail_2 (int);
3 extern void cleanup (void *);
5 struct header {
6 int signature;
7 };
9 int test_1 (void) {
10 int fd, ret = 0;
11 void *data = ((void *)0);
12 struct header *hdr;
14 fd = could_fail_1 ();
16 if (fd < 0) {
17 ret = -1;
18 goto cleanup;
21 data = could_fail_2 (fd);
22 hdr = (struct header *) data;
24 if (hdr->signature != 42) {
25 ret = -2;
26 goto cleanup;
29 cleanup:
30 if (ret) {
31 if (data) /* { dg-bogus "check of 'data' for NULL after already dereferencing it" } */
32 cleanup (data);
35 return ret;