mailing list of musl libc
 help / color / mirror / code / Atom feed
From: "Clément Vasseur" <clement.vasseur@gmail.com>
To: musl@lists.openwall.com
Subject: broken gcc optimization for facilitynames
Date: Wed, 18 Jun 2014 16:31:58 +0000 (UTC)	[thread overview]
Message-ID: <lnsett$5et$2@ger.gmane.org> (raw)

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



             reply	other threads:[~2014-06-18 16:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-18 16:31 Clément Vasseur [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='lnsett$5et$2@ger.gmane.org' \
    --to=clement.vasseur@gmail.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).