[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: clang's Undefined Sanitizer
From: |
Bruno Haible |
Subject: |
Re: clang's Undefined Sanitizer |
Date: |
Thu, 24 Aug 2017 12:12:57 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-91-generic; KDE/5.18.0; x86_64; ; ) |
Hi Paul,
This change
@@ -1780,8 +1627,7 @@ glob_in_dir (const char *pattern, const char *directory,
int flags,
while (1)
{
struct globnames *old = names;
- size_t i;
- for (i = 0; i < cur; ++i)
+ for (size_t i = 0; i < cur; ++i)
free (names->name[i]);
names = names->next;
/* NB: we will not leak memory here if we exit without
@@ -1806,8 +1652,7 @@ glob_in_dir (const char *pattern, const char *directory,
int flags,
while (1)
{
struct globnames *old = names;
- size_t i;
- for (i = 0; i < cur; ++i)
+ for (size_t i = 0; i < cur; ++i)
new_gl_pathv[pglob->gl_offs + pglob->gl_pathc++]
= names->name[i];
names = names->next;
causes a build failure of a testdir of module 'glob' on NetBSD 7 and OpenBSD 6.
On NetBSD 7.0:
gcc -DHAVE_CONFIG_H -I. -I../../gllib -I.. -DGNULIB_STRICT_CHECKING=1
-I/home/bruno/include -Wall -g -O2 -MT glob.o -MD -MP -MF .deps/glob.Tpo -c -o
glob.o ../../gllib/glob.c
../../gllib/glob.c: In function 'glob_in_dir':
../../gllib/glob.c:1630:15: error: 'for' loop initial declarations are only
allowed in C99 mode
for (size_t i = 0; i < cur; ++i)
^
../../gllib/glob.c:1630:15: note: use option -std=c99 or -std=gnu99 to compile
your code
../../gllib/glob.c:1655:15: error: 'for' loop initial declarations are only
allowed in C99 mode
for (size_t i = 0; i < cur; ++i)
^
*** Error code 1
On OpenBSD 6.0:
gcc -DHAVE_CONFIG_H -I. -I../../gllib -I.. -DGNULIB_STRICT_CHECKING=1
-I/home/bruno/include -Wall -g -O2 -MT glob.o -MD -MP -MF .deps/glob.Tpo -c -o
glob.o ../../gllib/glob.c
../../gllib/glob.c: In function 'glob_in_dir':
../../gllib/glob.c:1630: error: 'for' loop initial declaration used outside C99
mode
../../gllib/glob.c:1655: error: 'for' loop initial declaration used outside C99
mode
*** Error 1 in gllib (Makefile:1201 'glob.o')
The following patch fixes it.
2017-08-24 Bruno Haible <address@hidden>
glob: Fix compilation error on NetBSD 7.0 and OpenBSD 6.0.
* modules/glob (Depends-on): Add c99.
diff --git a/modules/glob b/modules/glob
index 0d64124..48cf387 100644
--- a/modules/glob
+++ b/modules/glob
@@ -12,6 +12,7 @@ lib/globfree.c
m4/glob.m4
Depends-on:
+c99
extensions
largefile
snippet/c++defs
- Re: clang's Undefined Sanitizer, (continued)
- Re: clang's Undefined Sanitizer, Bruno Haible, 2017/08/22
- Re: clang's Undefined Sanitizer, Paul Eggert, 2017/08/22
- Re: clang's Undefined Sanitizer, Adhemerval Zanella, 2017/08/22
- Re: clang's Undefined Sanitizer, Paul Eggert, 2017/08/22
- Re: clang's Undefined Sanitizer, Adhemerval Zanella, 2017/08/22
- Re: clang's Undefined Sanitizer, Paul Eggert, 2017/08/23
- Re: clang's Undefined Sanitizer, Bruno Haible, 2017/08/24
- Re: clang's Undefined Sanitizer, Benno Schulenberg, 2017/08/24
- Re: clang's Undefined Sanitizer, Benno Schulenberg, 2017/08/27
- Re: clang's Undefined Sanitizer, Bruno Haible, 2017/08/27
- Re: clang's Undefined Sanitizer,
Bruno Haible <=
- Re: c99 and IRIX, Bruno Haible, 2017/08/24
- Re: c99 and IRIX, Paul Eggert, 2017/08/24
- Re: c99 and IRIX, Tom G. Christensen, 2017/08/29
- Re: clang's Undefined Sanitizer, Bruno Haible, 2017/08/24
- Re: clang's Undefined Sanitizer, Paul Eggert, 2017/08/25
- Re: clang's Undefined Sanitizer, Bruno Haible, 2017/08/27
- Re: clang's Undefined Sanitizer, Tim Rühsen, 2017/08/23
Re: Valgrind is complaining unitialized values in freea (malloca.c:135), Bruno Haible, 2017/08/22