Skip to content

Commit 09e729f

Browse files
committed
Turns out that '__builtin_alloca' takes 'unsigned long', not 'unsigned long long'; rename some parameters to align with C11 standard.
1 parent 11ed4f3 commit 09e729f

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

cpp/ql/test/query-tests/Likely Bugs/Memory Management/AllocaInLoop/AllocaInLoop1.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ extern int w1, w2;
1010
#define restrict __restrict__
1111
#endif
1212

13-
void *__builtin_alloca(unsigned long long sz);
13+
void *__builtin_alloca(unsigned long sz);
1414
#define alloca __builtin_alloca
15-
typedef unsigned long size_t;
15+
typedef unsigned long long size_t;
1616

1717
int printf(const char *restrict format, ...);
1818
void *memcpy(void *restrict s1, const void *restrict s2, size_t n);

cpp/ql/test/query-tests/Likely Bugs/Memory Management/AllocaInLoop/AllocaInLoop2.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
// semmle-extractor-options: --clang
22
int printf(const char *restrict format, ...);
3-
int sprintf(char *restrict buf, const char *restrict format, ...);
4-
typedef unsigned long size_t;
3+
int sprintf(char *restrict s, const char *restrict format, ...);
4+
typedef unsigned long long size_t;
55
void *memcpy(void *restrict s1, const void *restrict s2, size_t n);
6-
void *malloc(size_t sz);
6+
void *malloc(size_t size);
77
void free(void *ptr);
88

99
struct vtype { int i1, i2; };
1010
extern int w1, w2;
1111

12-
void *_builtin_alloca(unsigned long long sz);
12+
void *_builtin_alloca(unsigned long sz);
1313
#define alloca __builtin_alloca
1414

1515
// We forward-declare the Microsoft routines

cpp/ql/test/query-tests/Likely Bugs/Memory Management/AllocaInLoop/AllocaInLoop3.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
#define restrict __restrict__
77
#endif
88

9-
int sprintf(char *restrict buf, const char *restrict format, ...);
10-
char * strdup(const char *restrict str1);
9+
int sprintf(char *restrict s, const char *restrict format, ...);
10+
char * strdup(const char *restrict s);
1111

12-
void *__builtin_alloca(unsigned long long sz);
12+
void *__builtin_alloca(unsigned long sz);
1313
#define alloca __builtin_alloca
1414

1515
// case 1: a GNU c/c++ lambda with an alloca in it

0 commit comments

Comments
 (0)