mirror of
https://github.com/ocornut/imgui.git
synced 2026-11-14 19:04:44 +00:00
GCC warning #5343
Labels
No labels
accidentally closed
android
backends
bug
building
clipper
coloredit
color spaces
cplusplus
data types
demo
disabled
doc
docking
dpi
drag drop
drawing/drawlist
dropped
dx12
enhancement
focus
font/text
gallery
help wanted
idle/power saving
ime
in progress
inputs
inputtext
internals
label/id and id stack
language bindings
layout
linux/bsd
menus
multi-contexts
multi-threading
multi-viewports
nav
news/info
opengl
optimization
osx/ios
overlap
plot/graph
popups
question
scrolling
selection
settings
sliders/drags
style
tables/columns
tabs
test wanted
tools
tooltips
tree
tricks & tips
useful widgets
vulkan
web
window pos/depth
window sizing
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ocornut/imgui#5343
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Version/Branch of Dear ImGui:
Version: 1.87
Branch: master
Back-end/Renderer/Compiler/OS
Compiler: gcc version 12.1.0 (Rev1, Built by MSYS2 project)
Operating System: Windows
My Issue/Question:
Compiling gives the following warning (with target Windows 64 bit):
Hello, thanks for reporting.
I am confused how that's possible.
Can you look at the code and investigate ?
Do you have an unmodified version of dear imgui ? What is the exact command line leading to compile imgui_draw.cpp ?
I'm confused too.
gcc -O1 -c imgui_draw.cppon unmodified sources is enough to trigger the warning. Without-O1there is no warning.I'm struggling to understand why it does it on:
And not
Which are located earlier the same file.
I am tempted to say this might be a bug in GCC..
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88443
They seem to be collecting reports for that... If you can report on GCC website it may be helpful.
@neclepsio Does changing it to
Fixes the warning?
No, it doesn't.
I got this warning with GCC 12.2.1. It was triggered by my
IM_ASSERTbeing defined to call a function that didif(!expr) throw+ the compiler deciding to not inline it(?).It looks like GCC missed the hint from the
IM_ASSERT(user_rects.Size >= 1)and thought there's a valid path where the signed size can be negative.https://godbolt.org/z/ETcsb3n7P
The warning went away after changing my
IM_ASSERTto be(_EXPR ? (void)0 : UnconditionallyThrow(#_EXPR)). (And it comes back if I remove that assert inImFontAtlasBuildPackCustomRects.)EDIT: Doesn't happen here with
gcc -O1 -c imgui_draw.cppand stock imconfig.h – unless that assertion is commented out.Thanks for posting.
Do you have a suggestion of what could be done on our side?
General fix would probably be using an unsigned type for quantities everywhere. A more reasonable change, to workaround that one specific case (unsure if GCC bug?), could be:
I would push this fix but could you provide a repro in the form of an
#define IM_ASSERT xxxand gcc compilation line that triggers the issue for you?-O3IMGUI_ENABLE_FREETYPEis defined (or the call tostbrp_pack_rectsinImFontAtlasBuildWIthStbTruetypeis commented out)throw SomethingThatCanThrow();(eg.throw std::runtime_error { msg },throw new int;,throw std::string { msg };)It's weird... (If the assertion function always returns or
#define IM_ASSERT(_EXPR) (void)0then it can be duplicated with only-O1+IMGUI_ENABLE_FREETYPEor same commentedstbrp_pack_rects)EDIT: Tried to narrow it down further by removing parts of imgui_draw.cpp until the warning went away (hoping to find a minimal snippet that could be reported). At some point adding or removing one of
StyleColorsDark's lines determined whether that warning shows up!