https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64478

Bernd Edlinger <bernd.edlinger at hotmail dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |---

--- Comment #12 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
Andrew,

please stop setting this bug to INVALID all the time
that is not really funny any more.

And I don't see, why this cant be fixed at all,
there are only one or two memory allocations that have to be
be pre-allocated in some kind of signal safe memory pool.

Just to prove the concept I changed the test case c380004
to do some memory allocations while waiting for the
asynchronous signal.

--- ../gcc-trunk/gcc/testsuite/ada/acats/tests/c3/c380004.a    2014-05-24
19:26:48.763568674 +0200
+++ c380004.adb    2015-01-03 11:41:04.198306842 +0100
@@ -36,6 +36,7 @@
 --!
 with Report;
 use Report;
+with Unchecked_Deallocation;
 procedure C380004 is

     type Rec (D1, D2 : Positive) is
@@ -180,7 +181,9 @@
         end;
     end Check;

-
+   type P is access Rec;
+   procedure Deallocate is new Unchecked_Deallocation(Rec, P);
+   pp : P;
 begin
     Test ("C380004",
           "Check evaluation of discriminant expressions " &
@@ -190,6 +193,11 @@


     Comment ("Discriminant-dependent entry families for task types");
+    for I in 1..1000000000 loop
+    pp := new Rec(1,2);
+    Deallocate(pp);
+    end loop;
+--  delay 60.0;

     F1_Poe := 18;



usually I get this:

ed@w-ed:~/gnu/gcc-test$ ./c380004 &
[1] 21589
ed@w-ed:~/gnu/gcc-test$ 
,.,. C380004 ACATS 2.5 15-01-03 11:45:42
---- C380004 Check evaluation of discriminant expressions when the
                constraint depends on a discriminant, and the
                discriminants have defaults -
                discriminant-dependententry families and protected
                components.
   - C380004 Discriminant-dependent entry families for task types.

ed@w-ed:~/gnu/gcc-test$ killall -SIGSEGV c380004
   * C380004 Unexpected exception.
**** C380004 FAILED ****************************.
ed@w-ed:~/gnu/gcc-test$ 
[1]+  Fertig                  ./c380004
ed@w-ed:~/gnu/gcc-test$

but after several re-tries the killed process freezes:


ed@w-ed:~/gnu/gcc-test$ ./c380004 &
[1] 21592
ed@w-ed:~/gnu/gcc-test$ 
,.,. C380004 ACATS 2.5 15-01-03 11:45:46
---- C380004 Check evaluation of discriminant expressions when the
                constraint depends on a discriminant, and the
                discriminants have defaults -
                discriminant-dependententry families and protected
                components.
   - C380004 Discriminant-dependent entry families for task types.

ed@w-ed:~/gnu/gcc-test$ 
ed@w-ed:~/gnu/gcc-test$ killall -SIGSEGV c380004
ed@w-ed:~/gnu/gcc-test$ 
ed@w-ed:~/gnu/gcc-test$ 
ed@w-ed:~/gnu/gcc-test$ ps
  PID TTY          TIME CMD
 2244 pts/0    00:00:00 bash
21592 pts/0    00:00:01 c380004
21596 pts/0    00:00:00 ps

ed@w-ed:~/gnu/gcc-test$ sudo bash
[sudo] password for ed: 
root@w-ed:~/gnu/gcc-test# gdb
GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) attach 21592
Attaching to process 21592
Reading symbols from /home/ed/gnu/gcc-test/c380004...done.
Reading symbols from /lib/x86_64-linux-gnu/libpthread.so.0...Reading symbols
from /usr/lib/debug//lib/x86_64-linux-gnu/libpthread-2.19.so...done.
done.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Loaded symbols for /lib/x86_64-linux-gnu/libpthread.so.0
Reading symbols from /lib/x86_64-linux-gnu/libc.so.6...Reading symbols from
/usr/lib/debug//lib/x86_64-linux-gnu/libc-2.19.so...done.
done.
Loaded symbols for /lib/x86_64-linux-gnu/libc.so.6
Reading symbols from /lib64/ld-linux-x86-64.so.2...Reading symbols from
/usr/lib/debug//lib/x86_64-linux-gnu/ld-2.19.so...done.
done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
__lll_lock_wait_private ()
    at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:95
95    ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: Datei oder
Verzeichnis nicht gefunden.
(gdb) bt
#0  __lll_lock_wait_private ()
    at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:95
#1  0x00007f3549a8d84a in _L_lock_12779 () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x00007f3549a8b225 in __GI___libc_malloc (bytes=704) at malloc.c:2887
#3  0x00000000004310d1 in <__gnat_malloc> (size=size@entry=704)
    at s-memory.adb:92
#4  0x0000000000439c70 in system.exceptions.machine.new_occurrence ()
    at s-excmac.ads:183
#5  0x00000000004242c1 in
ada.exceptions.exception_propagation.allocate_occurrence () at a-exexpr.adb:188
#6  0x000000000042521c in ada.exceptions.raise_with_location_and_msg (
    e=0x65c8e0 <storage_error>, f=f@entry=(const system__address) 0x4437a0, 
    l=l@entry=139, c=c@entry=0, m=m@entry=(const system__address) 0x444260)
    at a-except.adb:1159
#7  0x00000000004251fa in <__gnat_raise_storage_error_msg> (
    file=file@entry=(const system__address) 0x4437a0, line=line@entry=139, 
    msg=msg@entry=(const system__address) 0x444260) at a-except.adb:1144
#8  0x00000000004254bf in <__gnat_rcheck_SE_Explicit_Raise> (
    file=file@entry=(const system__address) 0x4437a0, line=line@entry=139)
    at a-except.adb:1438
#9  0x0000000000421388 in system.interrupt_management.notify_exception (
    signo=11, siginfo=<optimized out>, 
    ucontext=(const system__address) 0x664540) at s-intman.adb:139
---Type <return> to continue, or q <return> to quit---
#10 <signal handler called>
#11 0x00007f3549a88db0 in _int_malloc (av=0x7f3549dc7760 <main_arena>, bytes=8)
    at malloc.c:3355
#12 0x00007f3549a8b230 in __GI___libc_malloc (bytes=8) at malloc.c:2891
#13 0x00000000004310d1 in <__gnat_malloc> (size=<optimized out>)
    at s-memory.adb:92
#14 0x0000000000408117 in c380004 () at c380004.adb:197
(gdb)

Reply via email to