Skip to content

Commit 835d799

Browse files
committed
Fix a bug related to the recent porting of C++ builds.
1 parent aba0202 commit 835d799

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

tools/flang2/flang2exe/llassem.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5462,13 +5462,21 @@ get_uplevel_address_size()
54625462
return 0;
54635463
}
54645464

5465+
// FIXME: We are accessing a DT_PTR's element type (a DTYPE), but going to use
5466+
// it as a TY_KIND.
5467+
INLINE static TY_KIND
5468+
ThisIsAnAccessBug(DTYPE dtype)
5469+
{
5470+
return (TY_KIND) DTySeqTyElement(dtype);
5471+
}
5472+
54655473
/* If AG_UPLEVEL_OLD is 0, then it is len of character of the previous argument
54665474
* and
54675475
* it is passing by value - it is 32-bit in size for 32-bit and 64-bit for
54685476
* 64-bit target.
54695477
*/
54705478
void
5471-
_fixup_llvm_uplevel_symbol()
5479+
_fixup_llvm_uplevel_symbol(void)
54725480
{
54735481
int gblsym, outer_gblsym, i, j, sptr;
54745482
DTYPE dtype;
@@ -5524,8 +5532,8 @@ _fixup_llvm_uplevel_symbol()
55245532
* reallocate new memory for charlen.
55255533
*/
55265534
if (DTYG(dtype) == TY_CHAR || DTYG(dtype) == TY_NCHAR ||
5527-
(DTYG(dtype) == TY_PTR && DTY(DTySeqTyElement(dtype)) == TY_CHAR) ||
5528-
(DTYG(dtype) == TY_PTR && DTY(DTySeqTyElement(dtype)) == TY_NCHAR)) {
5535+
(DTYG(dtype) == TY_PTR && (ThisIsAnAccessBug(dtype) == TY_CHAR)) ||
5536+
(DTYG(dtype) == TY_PTR && (ThisIsAnAccessBug(dtype) == TY_NCHAR))) {
55295537
/* add extra space to put char len */
55305538
cnt++;
55315539

0 commit comments

Comments
 (0)