Skip to content

Commit 01c9f54

Browse files
JeffBezansonstaticfloat
authored andcommitted
fix #42590, long attribute loop compiling cfunction (#42635)
(cherry picked from commit 687b1e0)
1 parent fa6f4f0 commit 01c9f54

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/codegen.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4853,9 +4853,11 @@ static Function* gen_cfun_wrapper(
48534853
newAttributes.emplace_back(it, AttributeSet::get(jl_LLVMContext, attrBuilder));
48544854

48554855
// Shift forward the rest of the attributes
4856-
for(;it < attributes.index_end(); ++it) {
4857-
if (attributes.hasAttributes(it)) {
4858-
newAttributes.emplace_back(it + 1, attributes.getAttributes(it));
4856+
if (attributes.getNumAttrSets() > 0) { // without this check the loop range below is invalid
4857+
for(;it < attributes.index_end(); ++it) {
4858+
if (attributes.hasAttributes(it)) {
4859+
newAttributes.emplace_back(it + 1, attributes.getAttributes(it));
4860+
}
48594861
}
48604862
}
48614863

0 commit comments

Comments
 (0)