[PATCH] D31591: Fix a bug which access nullptr and cause segmentation fault

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 4 10:25:48 PDT 2017


ahatanak added inline comments.


================
Comment at: clang/test/Sema/sema-segvcheck.c:3
+// RUN: %clang_cc1 -fsyntax-only %s; test $? -eq 1
+
+typedef struct {
----------------
You can simplify the test case. Compiling the following code still segfaults:

```
typedef struct {
  unsigned long long house;
} struct_0;


typedef union {
  unsigned cows;
  unsigned char c;
} union_1;


typedef struct {
  struct_0 s0;
  union_1 s1;
} struct_2;

struct_2 s = {
  .s0 = {
    .dog = 0x00000009,
  },

  .s1 = {
    .cows = 0x00000055,
    .c = 1,
  },
};
```

Also, would it be better to add this test to an existing file (e.g., test/Sema/designated-initializers.c) rather than creating a new file?


https://reviews.llvm.org/D31591





More information about the cfe-commits mailing list