public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/99802] New: [11 regression] Assignment of aggregate done component-by-component
@ 2021-03-28 16:16 simon at pushface dot org
  2021-03-29  7:39 ` [Bug ada/99802] " rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: simon at pushface dot org @ 2021-03-28 16:16 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99802
           Summary: [11 regression] Assignment of aggregate done
                    component-by-component
           Product: gcc
           Version: 11.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 50481
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50481&action=edit
Demonstrator, with output assembler

In arm-eabi-gcc version 11.0.1 20210303 (experimental) (GCC),
assigning an aggregate to a memory-mapped register is performed by
assigning the components of the aggregate one-by-one to the register
rather than as a whole word.
The same bug is present in the x86_64-apple-darwin compiler.

In compiler releases up to & including 10, this was done using a
whole-word assignment.

   with ATSAM3X8E; use ATSAM3X8E;
   with ATSAM3X8E.PMC; use ATSAM3X8E.PMC;
   procedure Clock is
   begin
      PMC_Periph.CKGR_MOR :=
        (KEY      => 16#37#,
         MOSCXTEN => 1,     -- main crystal oscillator enable
         MOSCRCEN => 1,     -- main on-chip rc osc. enable
         MOSCXTST => 8,     -- startup time
         others   => <>);
   end Clock;

The register is a component of a record:

   type PMC_Peripheral is record
      ...
      CKGR_MOR   : aliased CKGR_MOR_Register;
      pragma Volatile_Full_Access (CKGR_MOR);
      ...
   end record
     with Volatile;

with object as so:

   PMC_Periph : aliased PMC_Peripheral
     with Import, Address => PMC_Base;

and the write respects the Volatile_Full_Access *as it writes each
component separately to the register*! This fails, in this case,
because the PMC hardware requires each write to this register to be
accompanied by a valid value of the KEY field.

The attached aggregate_assignment.zip contains Ada source, and the
10.1.0 and 11.0.1 versions of the arm-eabi cortex-m3 assembler output
by -S.

I've tried compiling the source in aggregate_assignment.zip with the
x86_64-apple-darwin compiler, and the same bug seems to be present.

NOTE, this bug is also present in GNAT CE 2020.

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

end of thread, other threads:[~2021-03-29 22:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-28 16:16 [Bug ada/99802] New: [11 regression] Assignment of aggregate done component-by-component simon at pushface dot org
2021-03-29  7:39 ` [Bug ada/99802] " rguenth at gcc dot gnu.org
2021-03-29 16:58 ` jakub at gcc dot gnu.org
2021-03-29 17:32 ` ebotcazou at gcc dot gnu.org
2021-03-29 17:32 ` [Bug ada/99802] [11 regression] assignment " ebotcazou at gcc dot gnu.org
2021-03-29 22:46 ` cvs-commit at gcc dot gnu.org
2021-03-29 22:47 ` ebotcazou 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).