public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/57321] New: static function call miscompiled at -Os and above
@ 2013-05-17 22:35 dhazeghi at yahoo dot com
  2013-05-18 11:48 ` [Bug rtl-optimization/57321] " mikpe at it dot uu.se
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: dhazeghi at yahoo dot com @ 2013-05-17 22:35 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57321

            Bug ID: 57321
           Summary: static function call miscompiled at -Os and above
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dhazeghi at yahoo dot com

The testcase below is miscompiled by gcc 4.8 on x86_64-linux, resulting in a
segfault when built with -Os or higher optimization levels.  This does not
occur with gcc 4.7 or current trunk.  The segfault appears on line 8, where p
is dereferenced and compared.

$ gcc-4.8 -v
gcc version 4.8.0 (GCC) 
$ gcc-4.8 -O1 small.c
$ ./a.out 
$ gcc-4.7 -Os small.c
$ ./a.out 
$ gcc-4.8 -Os small.c
$ ./a.out 
Segmentation fault (core dumped)

------------------------

int a = 1;
int *b;
int **c;

static int
bar(int *p)
{
    if (*p == a)
    {
        int *i[7][1][9] = {{{ 0 }}};
        int **j[1][1][1];
        j[0][0][0] = &i[0][0][0] ;
        *b = &p != c;
    }
    return 0;
}


void
foo(int p, int q)
{
    int i = 0;
    if (bar (&i))
        ;
}

int
main()
{
    foo (0, 0);
    return 0;
}


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

* [Bug rtl-optimization/57321] static function call miscompiled at -Os and above
  2013-05-17 22:35 [Bug rtl-optimization/57321] New: static function call miscompiled at -Os and above dhazeghi at yahoo dot com
@ 2013-05-18 11:48 ` mikpe at it dot uu.se
  2013-05-21  7:26 ` [Bug rtl-optimization/57321] [4.8/4.9 Regression] " jakub at gcc dot gnu.org
  2013-05-21  8:00 ` [Bug tree-optimization/57321] " jakub at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: mikpe at it dot uu.se @ 2013-05-18 11:48 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57321

--- Comment #1 from Mikael Pettersson <mikpe at it dot uu.se> ---
I can reproduce the wrong-code.  It was fixed on 4.8 branch by r198737 aka
PR56988.


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

* [Bug rtl-optimization/57321] [4.8/4.9 Regression] static function call miscompiled at -Os and above
  2013-05-17 22:35 [Bug rtl-optimization/57321] New: static function call miscompiled at -Os and above dhazeghi at yahoo dot com
  2013-05-18 11:48 ` [Bug rtl-optimization/57321] " mikpe at it dot uu.se
@ 2013-05-21  7:26 ` jakub at gcc dot gnu.org
  2013-05-21  8:00 ` [Bug tree-optimization/57321] " jakub at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-05-21  7:26 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57321

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |jakub at gcc dot gnu.org
         Resolution|---                         |FIXED
   Target Milestone|---                         |4.8.1
            Summary|static function call        |[4.8/4.9 Regression] static
                   |miscompiled at -Os and      |function call miscompiled
                   |above                       |at -Os and above

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Confirmed.  Introduced with r193298, fixed on the trunk with r198540 and on the
branch with r198737.


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

* [Bug tree-optimization/57321] [4.8/4.9 Regression] static function call miscompiled at -Os and above
  2013-05-17 22:35 [Bug rtl-optimization/57321] New: static function call miscompiled at -Os and above dhazeghi at yahoo dot com
  2013-05-18 11:48 ` [Bug rtl-optimization/57321] " mikpe at it dot uu.se
  2013-05-21  7:26 ` [Bug rtl-optimization/57321] [4.8/4.9 Regression] " jakub at gcc dot gnu.org
@ 2013-05-21  8:00 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-05-21  8:00 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57321

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|rtl-optimization            |tree-optimization
         Resolution|FIXED                       |DUPLICATE

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Tue May 21 07:51:59 2013
New Revision: 199133

URL: http://gcc.gnu.org/viewcvs?rev=199133&root=gcc&view=rev
Log:
    PR tree-optimization/57321
    * gcc.c-torture/execute/pr57321.c: New test.

Added:
    trunk/gcc/testsuite/gcc.c-torture/execute/pr57321.c
Modified:
    trunk/gcc/testsuite/ChangeLog

Author: jakub
Date: Tue May 21 07:58:10 2013
New Revision: 199134

URL: http://gcc.gnu.org/viewcvs?rev=199134&root=gcc&view=rev
Log:
    PR tree-optimization/57321
    * gcc.c-torture/execute/pr57321.c: New test.

Added:
    branches/gcc-4_8-branch/gcc/testsuite/gcc.c-torture/execute/pr57321.c
Modified:
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog

*** This bug has been marked as a duplicate of bug 56988 ***


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

end of thread, other threads:[~2013-05-21  8:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-17 22:35 [Bug rtl-optimization/57321] New: static function call miscompiled at -Os and above dhazeghi at yahoo dot com
2013-05-18 11:48 ` [Bug rtl-optimization/57321] " mikpe at it dot uu.se
2013-05-21  7:26 ` [Bug rtl-optimization/57321] [4.8/4.9 Regression] " jakub at gcc dot gnu.org
2013-05-21  8:00 ` [Bug tree-optimization/57321] " jakub at gcc dot gnu.org

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