You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some question:
My machine have 8Gib memory, build cdda with clang comsume more memory and compile time than gcc, in this topic : #59424NetSysFiresays reason is LTO.
Those looks like compiler bugs. The int_id<>s get destroyed but the objects they refer to are stored elsewhere. There are several upstream bug reports about this, for example this one.
Some of them can be worked around easily like this:
action patch
diff --git a/src/action.cpp b/src/action.cpp
index 025a6e0160..687b1751cf 100644
--- a/src/action.cpp+++ b/src/action.cpp@@ -670,16 +670,16 @@ bool can_examine_at( const tripoint &p, bool with_pickup )
if( with_pickup && !here.has_flag( ter_furn_flag::TFLAG_SEALED, p ) && here.has_items( p ) ) {
return true;
}
- const furn_t &xfurn_t = here.furn( p ).obj();- const ter_t &xter_t = here.ter( p ).obj();+ const furn_id xfurn_t = here.furn( p );+ const ter_id xter_t = here.ter( p );- if( here.has_furn( p ) && xfurn_t.can_examine( p ) ) {+ if( here.has_furn( p ) && xfurn_t->can_examine( p ) ) {
return true;
}
if( here.partial_con_at( tripoint_bub_ms( p ) ) != nullptr ) {
return true;
}
- if( xter_t.can_examine( p ) ) {+ if( xter_t->can_examine( p ) ) {
return true;
}
but it's probably better to disable -Wdangling-reference and let ASan catch those issues instead.
Describe the bug
On fedora 38, build CDDA using GCC13 failed, clang works.
Make flags:
-j8
CLANG=0
CCACHE=1
RELEASE=1
LTO=1
TILES=1
SOUND=1
LOCALIZE=1
LANGUAGES=zh_CN
DYNAMIC_LINKING=0
RUNTESTS=0
-march=native
Attach save file
src/action.cpp: In function ‘bool can_examine_at(const tripoint&, bool)’:
src/action.cpp:673:19: 错误:possibly dangling reference to a temporary [-Werror=dangling-reference]
673 | const furn_t &xfurn_t = here.furn( p ).obj();
| ^~~~~~~
src/action.cpp:673:47: 附注:the temporary was destroyed at the end of the full expression ‘(& here)->map::furn((* & p)).int_id<furn_t>::obj()’
673 | const furn_t &xfurn_t = here.furn( p ).obj();
| ~~~~~~~~~~~~~~~~~~^~
src/action.cpp:674:18: 错误:possibly dangling reference to a temporary [-Werror=dangling-reference]
674 | const ter_t &xter_t = here.ter( p ).obj();
| ^~~~~~
src/action.cpp:674:44: 附注:the temporary was destroyed at the end of the full expression ‘(& here)->map::ter((* & p)).int_id<ter_t>::obj()’
674 | const ter_t &xter_t = here.ter( p ).obj();
| ~~~~~~~~~~~~~~~~~^~
在文件作用域:
cc1plus: 附注:unrecognized command-line option ‘-Wno-unknown-warning-option’ may have been intended to silence earlier diagnostics
cc1plus:所有的警告都被当作是错误
make: *** [Makefile:975: obj/tiles/action.o] Error 1
make: *** 正在等待未完成的任务....
src/activity_item_handling.cpp: In function ‘activity_reason_info can_do_activity_there(const activity_id&, Character&, const tripoint_bub_ms&, int)’:
src/activity_item_handling.cpp:1344:31: 错误:possibly dangling reference to a temporary [-Werror=dangling-reference]
1344 | const recipe &r = recipe_dictionary::get_uncraft( ( i.typeId() == itype_disassembly ) ?
| ^
src/activity_item_handling.cpp:1344:65: 附注:the temporary was destroyed at the end of the full expression ‘recipe_dictionary::get_uncraft(((& i)->item::typeId().string_id::operator==(itype_disassembly) ? item_components::only_item()().item::typeId() : (& i)->item::typeId()))’
1344 | const recipe &r = recipe_dictionary::get_uncraft( ( i.typeId() == itype_disassembly ) ?
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1345 | i.components.only_item().typeId() : i.typeId() );
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/activity_item_handling.cpp: In function ‘std::unordered_set<coords::coord_point<tripoint, coords::origin::abs, coords::scale::map_square> > generic_multi_activity_locations(Character&, const activity_id&)’:
src/activity_item_handling.cpp:2506:35: 错误:possibly dangling reference to a temporary [-Werror=dangling-reference]
2506 | const furn_t &f = here.furn( elem ).obj();
| ^
src/activity_item_handling.cpp:2506:60: 附注:the temporary was destroyed at the end of the full expression ‘(& here)->map::furn((* & elem)).int_id<furn_t>::obj()’
2506 | const furn_t &f = here.furn( elem ).obj();
| ~~~~~~~~~~~~~~~~~~~~~^~
src/activity_item_handling.cpp: In function ‘bool generic_multi_activity_do(Character&, const activity_id&, const activity_reason_info&, const tripoint_abs_ms&, const tripoint_bub_ms&)’:
src/activity_item_handling.cpp:2963:35: 错误:possibly dangling reference to a temporary [-Werror=dangling-reference]
2963 | const recipe &r = ( elem.typeId() == itype_disassembly ) ? elem.get_making() :
| ^
src/activity_item_handling.cpp:2964:69: 附注:the temporary was destroyed at the end of the full expression ‘recipe_dictionary::get_uncraft((& elem)->item::typeId())’
2964 | recipe_dictionary::get_uncraft( elem.typeId() );
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
在文件作用域:
cc1plus: 附注:unrecognized command-line option ‘-Wno-unknown-warning-option’ may have been intended to silence earlier diagnostics
cc1plus:所有的警告都被当作是错误
make: *** [Makefile:975: obj/tiles/activity_item_handling.o] Error 1
src/activity_actor.cpp: In function ‘hack_type get_hack_type(const tripoint&)’:
src/activity_actor.cpp:749:19: 错误:possibly dangling reference to a temporary [-Werror=dangling-reference]
749 | const furn_t &xfurn_t = here.furn( examp ).obj();
| ^~~~~~~
src/activity_actor.cpp:749:51: 附注:the temporary was destroyed at the end of the full expression ‘(& here)->map::furn((* & examp)).int_id<furn_t>::obj()’
749 | const furn_t &xfurn_t = here.furn( examp ).obj();
| ~~~~~~~~~~~~~~~~~~~~~~^~
src/activity_actor.cpp:750:18: 错误:possibly dangling reference to a temporary [-Werror=dangling-reference]
750 | const ter_t &xter_t = here.ter( examp ).obj();
| ^~~~~~
src/activity_actor.cpp:750:48: 附注:the temporary was destroyed at the end of the full expression ‘(& here)->map::ter((* & examp)).int_id<ter_t>::obj()’
750 | const ter_t &xter_t = here.ter( examp ).obj();
| ~~~~~~~~~~~~~~~~~~~~~^~
在文件作用域:
cc1plus: 附注:unrecognized command-line option ‘-Wno-unknown-warning-option’ may have been intended to silence earlier diagnostics
cc1plus:所有的警告都被当作是错误
make: *** [Makefile:975: obj/tiles/activity_actor.o] Error 1
Steps to reproduce
Build using GCC13.
Expected behavior
Build success.
Screenshots
No response
Versions and configuration
gcc (GCC) 13.1.1 20230426 (Red Hat 13.1.1-1) build error
clang version 16.0.1 (Fedora 16.0.1-1.fc38) works
Linux fedora 6.2.13-300.fc38.x86_64
cdda commit hash: 9f7c25d
Additional context
Probably related to:
#64210
I use my own build script:
https://github.com/tim110011/CDDA-fedora-build-script
Some question:
My machine have 8Gib memory, build cdda with clang comsume more memory and compile time than gcc, in this topic : #59424 NetSysFiresays reason is LTO.
The text was updated successfully, but these errors were encountered: