public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/58034] New: glibc nptl/tst-cleanup2 fail due to scheduling
@ 2013-07-31  0:21 amodra at gmail dot com
  2013-07-31 13:59 ` [Bug rtl-optimization/58034] " dje at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: amodra at gmail dot com @ 2013-07-31  0:21 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58034
           Summary: glibc nptl/tst-cleanup2 fail due to scheduling
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: amodra at gmail dot com

Created attachment 30575
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30575&action=edit
preprocessed test case

nprl/tst-cleanup2 fails when compiled with -O2 -mcpu=power6 due to sched1
moving an assignment to a REG over code that traps.

The relevant test case source:

  if (setjmp (jmpbuf))
    {
      puts ("Exiting main...");
      return 0;
    }

  sprintf (p, "This should segv\n");

  return 1;
}

The sprintf is optimised to three loads and stores.  The problem occurs due to
the assignment of 1 to the REG holding the function return value being
scheduled before the sprintf expansion.


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

* [Bug rtl-optimization/58034] glibc nptl/tst-cleanup2 fail due to scheduling
  2013-07-31  0:21 [Bug rtl-optimization/58034] New: glibc nptl/tst-cleanup2 fail due to scheduling amodra at gmail dot com
@ 2013-07-31 13:59 ` dje at gcc dot gnu.org
  2013-07-31 15:31 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dje at gcc dot gnu.org @ 2013-07-31 13:59 UTC (permalink / raw)
  To: gcc-bugs

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

David Edelsohn <dje at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-07-31
                 CC|                            |dje at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from David Edelsohn <dje at gcc dot gnu.org> ---
Confirmed.


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

* [Bug rtl-optimization/58034] glibc nptl/tst-cleanup2 fail due to scheduling
  2013-07-31  0:21 [Bug rtl-optimization/58034] New: glibc nptl/tst-cleanup2 fail due to scheduling amodra at gmail dot com
  2013-07-31 13:59 ` [Bug rtl-optimization/58034] " dje at gcc dot gnu.org
@ 2013-07-31 15:31 ` pinskia at gcc dot gnu.org
  2013-07-31 15:46 ` dje at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-07-31 15:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
  if (_setjmp (jmpbuf))

I wonder if this is due to _setjmp not being marked as return twice.


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

* [Bug rtl-optimization/58034] glibc nptl/tst-cleanup2 fail due to scheduling
  2013-07-31  0:21 [Bug rtl-optimization/58034] New: glibc nptl/tst-cleanup2 fail due to scheduling amodra at gmail dot com
  2013-07-31 13:59 ` [Bug rtl-optimization/58034] " dje at gcc dot gnu.org
  2013-07-31 15:31 ` pinskia at gcc dot gnu.org
@ 2013-07-31 15:46 ` dje at gcc dot gnu.org
  2013-07-31 15:52 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dje at gcc dot gnu.org @ 2013-07-31 15:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from David Edelsohn <dje at gcc dot gnu.org> ---
> I wonder if this is due to _setjmp not being marked as return twice.

Is that a missing decoration in the GLIBC declaration?


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

* [Bug rtl-optimization/58034] glibc nptl/tst-cleanup2 fail due to scheduling
  2013-07-31  0:21 [Bug rtl-optimization/58034] New: glibc nptl/tst-cleanup2 fail due to scheduling amodra at gmail dot com
                   ` (2 preceding siblings ...)
  2013-07-31 15:46 ` dje at gcc dot gnu.org
@ 2013-07-31 15:52 ` pinskia at gcc dot gnu.org
  2013-08-01  1:08 ` amodra at gmail dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-07-31 15:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
>   if (_setjmp (jmpbuf))
> 
> I wonder if this is due to _setjmp not being marked as return twice.

Looking at special_function_p, it should return ECF_RETURNS_TWICE for that decl
if I read the code correctly as it disregards the _ and then matches setjmp.


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

* [Bug rtl-optimization/58034] glibc nptl/tst-cleanup2 fail due to scheduling
  2013-07-31  0:21 [Bug rtl-optimization/58034] New: glibc nptl/tst-cleanup2 fail due to scheduling amodra at gmail dot com
                   ` (3 preceding siblings ...)
  2013-07-31 15:52 ` pinskia at gcc dot gnu.org
@ 2013-08-01  1:08 ` amodra at gmail dot com
  2013-08-06 23:00 ` [Bug rtl-optimization/58034] [4.8/4.9 Regression] " joseph at codesourcery dot com
  2013-08-19  9:53 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: amodra at gmail dot com @ 2013-08-01  1:08 UTC (permalink / raw)
  To: gcc-bugs

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

Alan Modra <amodra at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.7.2
      Known to fail|                            |4.8.1, 4.8.2, 4.9.0

--- Comment #5 from Alan Modra <amodra at gmail dot com> ---
This somewhat reduced testcase fails with mainline.

#include <setjmp.h>
#include <signal.h>

static sigjmp_buf jmpbuf;

static void
sig_handler (int signo)
{
  siglongjmp (jmpbuf, 1);
}

int
main (void)
{
  char *p = 0;
  struct sigaction sa;

  sa.sa_handler = sig_handler;
  sigemptyset (&sa.sa_mask);
  sa.sa_flags = SA_SIGINFO;

  if (sigaction (SIGSEGV, &sa, 0))
    return 1;

  if (setjmp (jmpbuf))
    return 0;
  __builtin_memcpy (p, "abc", 4);
  return 1;
}


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

* [Bug rtl-optimization/58034] [4.8/4.9 Regression] glibc nptl/tst-cleanup2 fail due to scheduling
  2013-07-31  0:21 [Bug rtl-optimization/58034] New: glibc nptl/tst-cleanup2 fail due to scheduling amodra at gmail dot com
                   ` (4 preceding siblings ...)
  2013-08-01  1:08 ` amodra at gmail dot com
@ 2013-08-06 23:00 ` joseph at codesourcery dot com
  2013-08-19  9:53 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: joseph at codesourcery dot com @ 2013-08-06 23:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
On Wed, 31 Jul 2013, amodra at gmail dot com wrote:

> The relevant test case source:
> 
>   if (setjmp (jmpbuf))
>     {
>       puts ("Exiting main...");
>       return 0;
>     }
> 
>   sprintf (p, "This should segv\n");
> 
>   return 1;
> }
> 
> The sprintf is optimised to three loads and stores.  The problem occurs due to
> the assignment of 1 to the REG holding the function return value being
> scheduled before the sprintf expansion.

Well, in valid code this sprintf can't trap (sprintf using glibc 
extensions to register format extensions might).  Optimizing to three 
loads and stores, and then scheduling them, seems a valid optimization to 
me.  Does -fnon-call-exceptions help?  (Though I'd prefer 
-fno-builtin-sprintf as a fix for the glibc test.)


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

* [Bug rtl-optimization/58034] [4.8/4.9 Regression] glibc nptl/tst-cleanup2 fail due to scheduling
  2013-07-31  0:21 [Bug rtl-optimization/58034] New: glibc nptl/tst-cleanup2 fail due to scheduling amodra at gmail dot com
                   ` (5 preceding siblings ...)
  2013-08-06 23:00 ` [Bug rtl-optimization/58034] [4.8/4.9 Regression] " joseph at codesourcery dot com
@ 2013-08-19  9:53 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-08-19  9:53 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |jakub at gcc dot gnu.org
         Resolution|---                         |INVALID

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I agree this looks like a glibc test issue rather than gcc bug.


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

end of thread, other threads:[~2013-08-19  9:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-31  0:21 [Bug rtl-optimization/58034] New: glibc nptl/tst-cleanup2 fail due to scheduling amodra at gmail dot com
2013-07-31 13:59 ` [Bug rtl-optimization/58034] " dje at gcc dot gnu.org
2013-07-31 15:31 ` pinskia at gcc dot gnu.org
2013-07-31 15:46 ` dje at gcc dot gnu.org
2013-07-31 15:52 ` pinskia at gcc dot gnu.org
2013-08-01  1:08 ` amodra at gmail dot com
2013-08-06 23:00 ` [Bug rtl-optimization/58034] [4.8/4.9 Regression] " joseph at codesourcery dot com
2013-08-19  9:53 ` 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).