This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Cleanup -gnatG output for machine code


This patch cleans up a minor glitch of outputting an extra
semicolon after the code statement appearing as the expression
of an Asm construct when using machine code.

The following is compiled on an x86 with -gnatG

     1. with system.machine_code; use system.machine_code;
     2. procedure repro is
     3.   c : integer := -1;
     4.   r : integer;
     5. begin
     6.   asm ("nop", integer'asm_output ("=m", r),
     7.        integer'asm_input("r", c));
     8.   if r /= 0 then
     9.     raise program_error;
    10.   end if;
    11. end;

and the output is:

Source recreated from tree for repro (body)
-------------------------------------------

with system;
with system.system__machine_code;
use system.system__machine_code;
with system.system__machine_code;

procedure repro is
   c : integer := -1;
   r : integer;
begin
   system__machine_code__asm_insn'(
   system__machine_code__asm__4 ("nop", integer'asm_output("=m", r),
     integer'asm_input("r", c), clobber => "", volatile => false));
   if r /= 0 then
      [program_error "explicit raise"]
   end if;
   return;
end repro;

There used to be an extra semicolon "false););" in the output

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-11-04  Robert Dewar  <dewar@adacore.com>

	* sprint.adb (Sprint_Node_Actual, case Qualified_Expression):
	Avoid junk semicolon after argument of machine code Asm operand.

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]