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

            Bug ID: 83535
           Summary: Doesn’t respect Size for an object
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: simon at pushface dot org
  Target Milestone: ---

Created attachment 42946
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42946&action=edit
Demonstrator

The code in which this problem surfaced is for a Cortex-M CPU, and writes to 
a hardware register to generate an external interrupt. The attached demo is 
for the desktop.

I expected the write to NVIC_STIR to be a 32-bit write, with the input IRQ
extended to 32 bits (the hardware requires a 32-bit write). GCC 5, 6 and 7 
all do this.

GCC 8 (8.0.0 20171216) only writes 8 bits, with the result that the 
expected interrupt isn’t triggered.

The actual code is

   procedure Trigger_Interrupt (IRQ : Ada.Interrupts.Interrupt_ID) is
      --  The Software Trigger Interrupt Register.
      NVIC_STIR : Ada.Interrupts.Interrupt_ID
      with
        Import,
        Atomic,
        Size    => 32,
        Address => System'To_Address (16#e000_ef00#);
   begin
      NVIC_STIR := IRQ;
   end Trigger_Interrupt;

where

package Ada.Interrupts is
   pragma Pure;
   type Interrupt_ID is range 0 .. 44;
   ...

Discussion at
https://groups.google.com/d/msg/comp.lang.ada/ThIioaYg-_Y/OCWJNhX0DAAJ

Reply via email to