Skip to content

Commit 1c231bb

Browse files
authored
Merge pull request #4522 from andreast271/link_conflict_crash
Avoid crash in linking conflict report by providing correct type for …
2 parents 9f63d79 + 578ba08 commit 1c231bb

File tree

4 files changed

+19
-1
lines changed

4 files changed

+19
-1
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
int foo(int *i)
2+
{
3+
return *i;
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
int foo(char *i)
2+
{
3+
return *i;
4+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
main.c
3+
other.c
4+
^EXIT=(64|1)$
5+
^SIGNAL=0$
6+
^CONVERSION ERROR$
7+
error: conflicting function declarations `foo'
8+
--
9+
^warning: ignoring

src/linking/linking.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ void linkingt::detailed_conflict_report_rec(
143143
if(depth>0 &&
144144
!base_type_eq(t1.subtype(), t2.subtype(), ns))
145145
{
146-
conflict_path=dereference_exprt(conflict_path);
146+
if(conflict_path.type().id() == ID_pointer)
147+
conflict_path = dereference_exprt(conflict_path);
147148

148149
detailed_conflict_report_rec(
149150
old_symbol,

0 commit comments

Comments
 (0)