Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Wed, 18 Jun 2014 16:31:58 +0000 (UTC)
From: Clément Vasseur <clement.vasseur@...il.com>
To: musl@...ts.openwall.com
Subject: broken gcc optimization for facilitynames

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).

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.