Bug 50600 - "Illegal instruction" when using pragma Profile (Restricted)
Summary: "Illegal instruction" when using pragma Profile (Restricted)
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: ada (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2011-10-03 15:33 UTC by Georg Bauhaus
Modified: 2024-10-26 11:51 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 15.0
Last reconfirmed: 2024-10-26 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Georg Bauhaus 2011-10-03 15:33:09 UTC
The program below will fail as indicated (or not run
correctly, depending on platform) when pragma profile
(Restricted) is in effect. Failures vary a little.
On Mac OS X 10.6.8, GCC 4.7.0 x86_64-apple-darwin10.8.0
from 20111002:

$ ./rstr 
rsrt
Illegal instruction
$

A seemingly hanging program (Debian 6, GCC 4.7.0
i686-pc-linux-gnu from 20110610). Stack traces in the debugger
have varied a bit (on Mac), but mostly list subprograms to do
with PO entry calls (waiting) and (pthread) mutex locking,
judging by the names. Program receives SIGSEGV in debugger.

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/GCC-4.7/libexec/gcc/x86_64-apple-darwin10.8.0/4.7.0/lto-wrapper
Target: x86_64-apple-darwin10.8.0
Configured with: /Users/bauhaus/src/GCC/configure --enable-languages=c,ada --disable-nls --prefix=/opt/GCC-4.7
Thread model: posix
gcc version 4.7.0 20111002 (experimental) (GCC)

If the program text is in file "rstr.ada", then

$ gnatchop -r -w rstr.ada && gnatmake rstr



pragma Profile (Restricted);
package Tsk is
   task Nop is
      pragma Priority (5);
   end Nop;
end Tsk;

with Report;
package body Tsk is
   task body Nop is
   begin
      Report.Put_Line ("Nop");
   end Nop;
end Tsk;

with Tsk;
with Report;
procedure Rstr is
begin
   Report.Put_Line ("rsrt");
end Rstr;

package Report is

   procedure Put_Line (Message : String);

private
   protected Output is
      entry Wait;
      procedure Release;
   private
      Available : Boolean := True;
   end Output;
end Report;

with Ada.Text_IO;

package body Report is
   procedure Put_Line (Message : String) is
   begin
      Output.Wait;
      Ada.Text_IO.Put_Line (Message);
      Ada.Text_IO.Flush;
      Output.Release;
   end Put_Line;

   protected body Output is
      entry Wait when Available is
      begin
         Available := False;
      end Wait;
      procedure Release is
      begin
         Available := True;
      end Release;
   end Output;
end Report;
Comment 1 Eric Botcazou 2015-12-06 14:31:09 UTC
Still fails on mainline.
Comment 2 Eric Botcazou 2024-10-26 10:55:52 UTC
Still hangs on mainline.