http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58573

            Bug ID: 58573
           Summary: Bug box on return conditional expression with an
                    imported function
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: laguest at archeia dot com

Created attachment 30927
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30927&action=edit
Minimal files to cause bug box.

After defining a function which imports another C function and using this as
the return type in a conditional expression, I get a bug box.

$ gnatmake -gnatd.n -c debug.adb 
gcc -c -gnatd.n debug.adb
/home/laguest/opt/tinyada/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/adainclude/system.ads
debug.adb
debug.ads
/home/laguest/opt/tinyada/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/adainclude/interfac.ads
/home/laguest/opt/tinyada/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/adainclude/i-c.ads
/home/laguest/opt/tinyada/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/adainclude/s-parame.ads
/home/laguest/opt/tinyada/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/adainclude/s-stalib.ads
/home/laguest/opt/tinyada/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/adainclude/ada.ads
/home/laguest/opt/tinyada/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/adainclude/a-unccon.ads
/home/laguest/opt/tinyada/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/adainclude/s-exctab.ads
+===========================GNAT BUG DETECTED==============================+
| 4.9.0 20130916 (experimental) (x86_64-unknown-linux-gnu) Assert_Failure
nlists.adb:930|
| Error detected at debug.adb:23:7                                         |
| Please submit a bug report; see http://gcc.gnu.org/bugs.html.            |
| Use a subject line meaningful to you and us to track the bug.            |
| Include the entire contents of this bug box in the report.               |
| Include the exact gcc or gnatmake command that you entered.              |
| Also include sources listed below in gnatchop format                     |
| (concatenated together with no headers between files).                   |
+==========================================================================+

Please include these source files with error report
Note that list may not be accurate in some cases,
so please double check that the problem can still
be reproduced with the set of files listed.
Consider also -gnatd.n switch (see debug.adb).

debug.adb
debug.ads

compilation abandoned
gnatmake: "debug.adb" compilation error

I can get around the bug by changing the code to a temporary c.int and doing
the test on that.

...
      Error : C.int := SDL_Pixel_Format_Enum_To_Masks
        (Format,
         Bits,
         Red_Mask,
         Green_Mask,
         Blue_Mask,
         Alpha_Mask);
   begin
      return (if Error  = 1 then True else False);
   end To_Masks;
...

Reply via email to