This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug ada/57964] New: Bug box with ambiguity combined with expression if


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

            Bug ID: 57964
           Summary: Bug box with ambiguity combined with expression if
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: prosfilaes at gmail dot com

with Problem; use Problem;

package Linear_Programming is
procedure Linear_Init;   
end Linear_Programming;
with Ada.Containers.Vectors;

package Problem is

   package Natural_Vector_Package is new Ada.Containers.Vectors (Positive,
Natural); -- We may need to stuff depots in there
   use Natural_Vector_Package;

   Num_Customers : Positive;
   Demand : Natural_Vector_Package.Vector;

end Problem;
with Ada.Containers.Vectors;
with Ada.Containers; use Ada.Containers;
with Interfaces.C; use Interfaces.C;

package body Linear_Programming is

   package Double_Vector is new Ada.Containers.Vectors (Positive, Double);
   procedure Linear_Init is
      AR : Double_Vector.Vector;
      V: Integer := 1;
   begin
         for I in 0 .. Num_Customers - 1 loop
            for J in I + 1 .. Num_Customers loop
               if (I = 0 and then J >= V) or else I >= V then
                  AR.Append (Interfaces.C.Double ((if I > 0 then Demand (I)
else 0) + Demand (J)) / 2.0);
               end if;
            end loop;
        end loop;
   end Linear_Init;

end Linear_Programming;

gets me
| 4.8.0 (x86_64-unknown-linux-gnu) Storage_Error stack overflow or erroneous
memory access|
| Error detected at linear_programming.adb:15:21                           |

compiled with gcc -c linear_programming.adb . (-gnat2012 gets rid of an error
about if expression being an Ada 2012 expression, but it's the same bug box
either way.)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]