From: Victor Porton <porton@narod.ru>
Subject: Re: Modern optimizing compilers
Date: Tue, 22 Aug 2017 04:17:24 +0300
Date: 2017-08-22T04:17:24+03:00 [thread overview]
Message-ID: <ong0n2$1roi$1@gioia.aioe.org> (raw)
In-Reply-To: ong0d0$1rda$1@gioia.aioe.org
Victor Porton wrote:
> gautier_niouzes@hotmail.com wrote:
>
>> You can compile a package containing a test procedure putting 123 into an
>> Integer field of a record (tagged or not) and look at the assembler
>> output. With GNAT it's gcc -S -O2 test_pkg.adb NB: the procedure probably
>> needs to feed then an "out" parameter to prevent the compiler optimizing
>> out completely the assignment with 123.
>
> It seems that your case is wrong.
>
> This procedure has no other choice than to write into the referenced
> record.
>
> We can however check with code like:
>
> procedure M is
> type T is record
> X: Integer;
> end record;
>
> I: T;
> begin
> I.X := 10;
> Ada.Text_IO.Put_Line(Integer'Image(I.X));
> end;
I don't understand the assembler output of compiling this program (with
added "with Ada.Text_IO;") with GCC 7.1.0, but it looks like very poorly
optimized (very long). I don't know why the assembler code is so long.
>> Gautier
>> _____________________________________________________________
>> A free online game in Ada: http://pasta.phyrama.com/game.html
>
--
Victor Porton - http://portonvictor.org
next prev parent reply other threads:[~2017-08-22 1:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-21 20:32 Modern optimizing compilers Victor Porton
2017-08-21 23:19 ` gautier_niouzes
2017-08-22 1:11 ` Victor Porton
2017-08-22 1:17 ` Victor Porton [this message]
2017-08-22 1:20 ` Victor Porton
2017-08-22 7:28 ` gautier_niouzes
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox