mailing list of musl libc
 help / color / mirror / code / Atom feed
* broken gcc optimization for facilitynames
@ 2014-06-18 16:31 Clément Vasseur
  2014-06-19  3:34 ` Rich Felker
  0 siblings, 1 reply; 7+ messages in thread
From: Clément Vasseur @ 2014-06-18 16:31 UTC (permalink / raw)
  To: musl

Hello,

I might have found a gcc code generation problem with the facilitynames
implementation used in musl. See the following reduced test case:

$ cat test-facilitynames.c
#define SYSLOG_NAMES
#include <syslog.h>
int main(void)
{
    for (int i = 0; facilitynames[i].c_name; i++)
        if (facilitynames[i].c_name)
            return facilitynames[i].c_val;
}

$ musl-gcc -std=gnu99 -O1 test-facilitynames.c && ./a.out; echo $?
32

$ musl-gcc -std=gnu99 -O2 test-facilitynames.c && ./a.out; echo $?
1

I see similar results with gcc versions 4.6.1, 4.8.3 and 4.9.0 (with a
different return value with -O2).



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-06-21  0:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-18 16:31 broken gcc optimization for facilitynames Clément Vasseur
2014-06-19  3:34 ` Rich Felker
2014-06-20 10:14   ` Christopher Meng
2014-06-20 22:13     ` Clément Vasseur
2014-06-20 22:09   ` Clément Vasseur
2014-06-20 22:51     ` Szabolcs Nagy
2014-06-21  0:34     ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).