AdaCore / gnat-llvm

LLVM based GNAT compiler
179 stars 18 forks source link

Size'Attribute error #23

Closed Alex-Gamper closed 2 years ago

Alex-Gamper commented 2 years ago

Hi AdaCore

I have managed to build LLVM (latest master branch) on mingw64 and am now testing the actual compiler. I came across the following error on LLVM which does NOT occur using GCC 11.2, was wondering if this is actually a bug in either GCC 11.2 or LLVM. Below is the code that is problematic,. The error that LLVM raises is

consoleapp3.adb:17:53: error: value outside permitted range gprbuild: *** compilation phase failed

(Note it doesnt seem to matter if the size attribute is before or after the "use clause")

procedure ConsoleApp3 is

   type GPT_ATTRIBUTES is (
      GPT_ATTRIBUTE_PLATFORM_REQUIRED_e,
      GPT_BASIC_DATA_ATTRIBUTE_READ_ONLY_e,
      GPT_BASIC_DATA_ATTRIBUTE_SHADOW_COPY_e,
      GPT_BASIC_DATA_ATTRIBUTE_HIDDEN_e,
      GPT_BASIC_DATA_ATTRIBUTE_NO_DRIVE_LETTER_e
   );
   for GPT_ATTRIBUTES'Size use 64;
   for GPT_ATTRIBUTES use (
      GPT_ATTRIBUTE_PLATFORM_REQUIRED_e => 1,
      GPT_BASIC_DATA_ATTRIBUTE_READ_ONLY_e => 1152921504606846976,
      GPT_BASIC_DATA_ATTRIBUTE_SHADOW_COPY_e => 2305843009213693952,
      GPT_BASIC_DATA_ATTRIBUTE_HIDDEN_e => 4611686018427387904,
      GPT_BASIC_DATA_ATTRIBUTE_NO_DRIVE_LETTER_e => 9223372036854775808
   );

    x : GPT_ATTRIBUTES;
begin
    x := GPT_BASIC_DATA_ATTRIBUTE_NO_DRIVE_LETTER_e;
end;
ArnaudCharlet commented 2 years ago

The difference is due to the fact that your GNAT sources are more recent for LLVM. If you build GCC with the same GNAT sources, you'll get the same error, which is the expected behavior.