GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gcc/ada

Ada: Fix run-time crash for imported C arrays without size

Fixes a runtime crash in Ada caused by incorrect handling of imported C arrays with unspecified sizes.

This commit resolves a regression in the Ada compiler that caused run-time crashes when dealing with imported C arrays that were declared without a size. The compiler previously added an indirect indirection for large objects intended for interfaces, which led to issues. The fix prevents this indirection for exported or imported objects, ensuring the compiler or linker will issue errors instead of crashing.

In Details

The allocatable_size_p function in gcc-interface/decl.cc was modified to correctly handle imported C arrays. Previously, it incorrectly determined that arrays without explicit sizes were 'allocatable', leading to an indirection that caused crashes when these arrays were part of an interface. The change ensures that such arrays are not treated as allocatable when imported or exported, enforcing proper size declarations.

Filed Under: adacompilerbugfix