diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2020-12-07 10:48:06 +0100 |
---|---|---|
committer | Eric Botcazou <ebotcazou@adacore.com> | 2020-12-07 10:48:06 +0100 |
commit | 67c4d1c7addc88c2d133731cf81ffad7d50fa8b9 (patch) | |
tree | ef65a492ce3d80d8aeb7316514183dc173300441 /gcc | |
parent | 6a1e04b2f0c28d46e193d30aac00a32ba850bf0a (diff) | |
download | gcc-67c4d1c7addc88c2d133731cf81ffad7d50fa8b9.zip gcc-67c4d1c7addc88c2d133731cf81ffad7d50fa8b9.tar.gz gcc-67c4d1c7addc88c2d133731cf81ffad7d50fa8b9.tar.bz2 |
Fix internal error on library-level type extended locally
The compiler aborts on the local extension of a tagged type declared
at library level, with a progenitor given by an interface type having
a primitive that is a homograph of a primitive of the tagged type.
gcc/ada/ChangeLog:
* gcc-interface/trans.c (maybe_make_gnu_thunk): Return false if the
target is local and thunk and target do not have the same context.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/gcc-interface/trans.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index bf8289b..4ab26d3 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -10730,8 +10730,11 @@ maybe_make_gnu_thunk (Entity_Id gnat_thunk, tree gnu_thunk) tree gnu_target = gnat_to_gnu_entity (gnat_target, NULL_TREE, false); - /* Thunk and target must have the same nesting level, if any. */ - gcc_assert (DECL_CONTEXT (gnu_thunk) == DECL_CONTEXT (gnu_target)); + /* If the target is local, then thunk and target must have the same context + because cgraph_node::expand_thunk can only forward the static chain. */ + if (DECL_STATIC_CHAIN (gnu_target) + && DECL_CONTEXT (gnu_thunk) != DECL_CONTEXT (gnu_target)) + return false; /* If the target returns by invisible reference and is external, apply the same transformation as Subprogram_Body_to_gnu here. */ |