damaki / libkeccak

SHA-3 and other Keccak related algorithms in SPARK/Ada.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compilation failures with GNAT Community 2020

damaki opened this issue · comments

Building libkeccak with the newly released GNAT Community 2020 results in compilation failures:

gprbuild -d -Plibkeccak.gpr -p
Compile
   [Ada]          keccak-parallel_keccak_1600.ads
   [Ada]          keccak-parallel_keccak_1600-rounds_24.ads
   [Ada]          keccak-parallel_keccak_1600-rounds_14.ads
   [Ada]          keccak-parallel_keccak_1600-rounds_12.ads
   [Ada]          tuple_hash.ads
   [Ada]          shake.ads
   [Ada]          sha3.ads
   [Ada]          rawshake.ads
   [Ada]          parallel_hash.ads
   [Ada]          marsupilamifourteen.ads
   [Ada]          kmac.ads
   [Ada]          ketje.ads
   [Ada]          keccak.ads
   [Ada]          keccak-util.adb
   [Ada]          keccak-types.ads
keccak-generic_monkeyduplex.ads:55:19: not subtype conformant with declaration at ketje.ads:66
keccak-generic_monkeyduplex.ads:55:19: formal subprograms are not subtype conformant (RM 6.3.1 (17/3))
keccak-generic_monkeyduplex.ads:55:19: not subtype conformant with declaration at ketje.ads:96
keccak-generic_monkeyduplex.ads:55:19: formal subprograms are not subtype conformant (RM 6.3.1 (17/3))
keccak-generic_monkeyduplex.ads:55:19: not subtype conformant with declaration at ketje.ads:126
keccak-generic_monkeyduplex.ads:55:19: formal subprograms are not subtype conformant (RM 6.3.1 (17/3))
keccak-generic_monkeyduplex.ads:55:19: not subtype conformant with declaration at ketje.ads:156
keccak-generic_monkeyduplex.ads:55:19: formal subprograms are not subtype conformant (RM 6.3.1 (17/3))
keccak-generic_monkeywrap.ads:62:04: instantiation error at keccak-generic_monkeyduplex.ads:55
keccak-generic_monkeywrap.ads:62:04: not subtype conformant with declaration at ketje.ads:66
keccak-generic_monkeywrap.ads:62:04: formal subprograms are not subtype conformant (RM 6.3.1 (17/3))

   compilation of ketje.ads failed

These compilation errors seem to be caused by a clash between subprograms with the same name in certain scopes.

For example, in ketje.ads there are lines such as (some parameters omitted for clarity):

      procedure XOR_Padding_Into_State is new Keccak.Padding.XOR_Pad101_Into_State
        (...)

      package MonkeyDuplex_Jr is new Keccak.Generic_MonkeyDuplex
        (...
         XOR_Padding_Into_State => XOR_Padding_Into_State,
         ...)

The compilation error seems to be that the declaration of XOR_Padding_Into_State clashes with the generic formal parameter of Generic_MonkeyDuplex of the same name. Renaming the XOR_Padding_Into_State procedure to something else avoids the problem.

All instances of this compilation error should be fixed by renaming functions as appropriate.

This is now fixed in #18