Skip to content

Work around weird g++ bug - #4509

Merged
roystgnr merged 1 commit into
libMesh:develfrom
roystgnr:weird_workaround
Aug 4, 2026
Merged

Work around weird g++ bug#4509
roystgnr merged 1 commit into
libMesh:develfrom
roystgnr:weird_workaround

Conversation

@roystgnr

@roystgnr roystgnr commented Aug 1, 2026

Copy link
Copy Markdown
Member

The former code was triggering a -Wfree-nonheap-object for me with g++ 15.2.0, but only with exceptions disabled, only in devel mode, and only with -std=c++20; c++17 and c++23 were both fine with it.

Too weird for me to distill, and the replacement code is better anyway.

This probably has nothing to do with our --disable-exceptions test failures, I just hit it while investigating those.

The former code was triggering a -Wfree-nonheap-object for me with g++
15.2.0, but only with exceptions disabled, only in devel mode, and only
with -std=c++20; c++17 and c++23 were both fine with it.

Too weird for me to distill, and the replacement code is better anyway.
@moosebuild

Copy link
Copy Markdown

Job Coverage, step Generate coverage on b8210d0 wanted to post the following:

Coverage

165cb7 #4509 b8210d
Total Total +/- New
Rate 65.82% 65.82% +0.00% 100.00%
Hits 79325 79325 - 1
Misses 41198 41197 -1 0

Diff coverage report

Full coverage report

This comment will be updated on new commits.

@jwpeterson jwpeterson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small question, but whatever works around the compiler bug is fine with me.

Comment thread src/systems/system_io.C
vars_to_read.clear();
vars_to_read.push_back(var_to_read);
}
vars_to_read.assign({var_to_read});

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was calling assign() actually necessary to work around the bug or would the (arguably simpler)

vars_to_read = {var_to_read};

have sufficed as well?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh - yes, that works too, as does assign(1, var_to_read). I've no clue why it's just the push_back() that gave me pushback. Irony?

@roystgnr
roystgnr merged commit 6ae6baf into libMesh:devel Aug 4, 2026
23 checks passed
@roystgnr
roystgnr deleted the weird_workaround branch August 4, 2026 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants