public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Matthias Klose <doko@net.local>
To: gcc-gnats@gcc.gnu.org, debian-gcc@lists.debian.org
Subject: target/10194: [3.2 regression] [arm] gcc optimization error with -O2, affecting bison
Date: Sun, 23 Mar 2003 20:26:00 -0000	[thread overview]
Message-ID: <E18xBSY-00053a-00@tango.net.local> (raw)


>Number:         10194
>Category:       target
>Synopsis:       [3.2 regression] [arm] gcc optimization error with -O2, affecting bison
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 23 19:56:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Lukas Geyer <lukas@debian.org>
>Release:        3.2.3 (Debian prerelease)
>Organization:
The Debian Project
>Environment:
System: Debian GNU/Linux (unstable)
Architecture: arm
host: arm-linux
Thread model: posix
gcc version 3.2.3 20030316 (Debian prerelease)
>Description:
[ Reported to the Debian BTS as report #185903.
  Please CC 185903@bugs.debian.org on replies.
  Log of report can be found at http://bugs.debian.org/185903 ]
	

[gcc-2.95 and gcc-3.3 CVS 20030221 do not show this behaviour]

Lukas Geyer writes:

I have been unable to cook up a short testcase, mainly due to bad
connectivity and lack of experience. However, bison-1.875a gets
miscompiled on arm with -O2, it seems to compile correctly with
-O1. My experiments where done in a sid chroot on debussy, so I used
the available versions in sid. Here are the relevant code sections and
what gdb shows.

src/reader.c:

  void
  epilogue_augment (const char *epilogue, location loc)
  {
    char *extension = NULL;
    obstack_fgrow1 (&muscle_obstack, "]b4_syncline([[%d]], [[", loc.start.line);
    MUSCLE_OBSTACK_SGROW (&muscle_obstack,
                          quotearg_style (c_quoting_style, loc.start.file));
    obstack_sgrow (&muscle_obstack, "]])[\n");
    obstack_sgrow (&muscle_obstack, epilogue);
    obstack_1grow (&muscle_obstack, 0);
    extension = obstack_finish (&muscle_obstack);
    muscle_grow ("epilogue", extension, "");
    obstack_free (&muscle_obstack, extension);
  }


lib/quotearg.c:

  char *
  quotearg_n_style (int n, enum quoting_style s, char const *arg)
  {
    struct quoting_options const o = quoting_options_from_style (s);
    return quotearg_n_options (n, arg, SIZE_MAX, &o);
  }

  char *
  quotearg_style (enum quoting_style s, char const *arg)
  {
    return quotearg_n_style (0, s, arg);
  }

gdb backtrace:

gdb backtrace:

#0  0x00027964 in quotearg_buffer_restyled (buffer=0x3d8f4 "\"YPE_NAME_OR_ID",
    buffersize=256, arg=0x2c <Address 0x2c out of bounds>, argsize=4294967295,
    quoting_style=c_quoting_style, o=0xbfffc510) at quotearg.c:481
#1  0x00027a64 in quotearg_buffer (buffer=0x3d8f4 "\"YPE_NAME_OR_ID",
    buffersize=0, arg=0x2c <Address 0x2c out of bounds>, argsize=4294967295,
    o=0xbfffc510) at quotearg.c:503
#2  0x00027b38 in quotearg_n_options (n=0,
    arg=0x2c <Address 0x2c out of bounds>, argsize=4294967295,
    options=0xbfffc510) at quotearg.c:560
#3  0x00027c84 in quotearg_n_style (n=0, s=256,
    arg=0x2c <Address 0x2c out of bounds>) at quotearg.c:600
#4  0x00018a38 in epilogue_augment (
    epilogue=0x950e0 "\n\n/*@@-redecl@@*/\nextern char *yytext;\n/*@@=redecl@@*/\n\n# include \"bison.reset\
\"\n\nvoid yyerror (/*@@unused@@*/ char *s) \n{\n  static bool givehint = FALSE;\n\n  if (context_inIterDef\
 ())\n    {\n      llerr"..., loc=
        {start = {file = 0x400e8d80 "", line = 0, column = 4096}, end = {file =
0x4013eb24 "0\n\022", line = 249784, column = 280128}}) at reader.c:94
#5  0x00015c0c in gram_parse () at parse-gram.y:399

Looking at this backtrace, it seems that the pointer loc.start.file is
passed incorrectly to quotearg_n_style, optimizing away
quotearg_style, subsequently causing a segfault. I can supply the .y
file which causes the segfault, if it would be helpful, or you can
just get from the source of lclint, it is cgrammar.y, see also
http://buildd.debian.org/fetch.php?&pkg=lclint&ver=1%3A2.4b-1.4&arch=arm&stamp=1048326775&file=log&as=raw

Best regards,
Lukas

P.S.: I recommend compiling the bison package with -O1 on arm, until
this issue is resolved. I will separately file a bug against bison
proposing this.

>How-To-Repeat:
	
>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2003-03-23 19:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-23 20:26 Matthias Klose [this message]
2003-04-28 11:24 ehrhardt
2003-04-30 21:06 Lukas Geyer
2003-05-03 13:12 ehrhardt

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=E18xBSY-00053a-00@tango.net.local \
    --to=doko@net.local \
    --cc=185903@bugs.debian.org \
    --cc=debian-gcc@lists.debian.org \
    --cc=gcc-gnats@gcc.gnu.org \
    /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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).