Created attachment 52938 [details] Build log in a case needed ``` 36-111% /opt/local/bin/gcc-mp-11 -DSDL2_EXPORTS -DUSING_GENERATED_CONFIG_H -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/build/include -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/include -pipe -Os -DNDEBUG -I/opt/local/include -idirafter "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/src/video/khronos" -I/opt/local/include/libusb-1.0 -D_THREAD_SAFE -Wshadow -fvisibility=hidden -Wdeclaration-after-statement -fno-strict-aliasing -Wall -arch ppc -mmacosx-version-min=10.6 -fPIC -MD -MT CMakeFiles/SDL2.dir/src/hidapi/SDL_hidapi.c.o -MF CMakeFiles/SDL2.dir/src/hidapi/SDL_hidapi.c.o.d -o CMakeFiles/SDL2.dir/src/hidapi/SDL_hidapi.c.o -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/src/hidapi/SDL_hidapi.c In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/src/hidapi/SDL_hidapi.c:578: /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/src/hidapi/mac/hid.c: In function 'PLATFORM_free_hid_device': /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/src/hidapi/mac/hid.c:163:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] 163 | struct input_report *rpt = dev->input_reports; | ^~~~~~ /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/src/hidapi/mac/hid.c: In function 'get_string_property': /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/src/hidapi/mac/hid.c:265:17: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] 265 | CFIndex str_len = CFStringGetLength(str); | ^~~~~~~ /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/src/hidapi/mac/hid.c:269:17: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] 269 | CFIndex used_buf_len; | ^~~~~~~ /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/src/hidapi/mac/hid.c: In function 'get_string_property_utf8': /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/src/hidapi/mac/hid.c:304:17: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] 304 | CFIndex str_len = CFStringGetLength(str); | ^~~~~~~ /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/src/hidapi/mac/hid.c:308:17: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] 308 | CFIndex used_buf_len; | ^~~~~~~ In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/src/hidapi/SDL_hidapi.c:578: /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/src/hidapi/mac/hid.c: In function 'PLATFORM_hid_enumerate': /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/src/hidapi/mac/hid.c:530:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] 530 | CFSetRef device_set = IOHIDManagerCopyDevices(hid_mgr); | ^~~~~~~~ /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/src/hidapi/mac/hid.c:540:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] 540 | IOHIDDeviceRef *device_array = (IOHIDDeviceRef*)calloc(num_devices, sizeof(IOHIDDeviceRef)); | ^~~~~~~~~~~~~~ /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/src/hidapi/mac/hid.c: In function 'PLATFORM_read_thread': /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/src/hidapi/mac/hid.c:742:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] 742 | CFRunLoopSourceContext ctx; | ^~~~~~~~~~~~~~~~~~~~~~ /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/src/hidapi/mac/hid.c:759:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] 759 | SInt32 code; | ^~~~~~ /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/src/hidapi/mac/hid.c: In function 'PLATFORM_hid_open_path': /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/src/hidapi/mac/hid.c:812:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] 812 | CFSetRef device_set = IOHIDManagerCopyDevices(hid_mgr); | ^~~~~~~~ /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/src/hidapi/mac/hid.c:815:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] 815 | IOHIDDeviceRef *device_array = (IOHIDDeviceRef *)calloc(num_devices, sizeof(IOHIDDeviceRef)); | ^~~~~~~~~~~~~~ /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/src/hidapi/mac/hid.c:848:33: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] 848 | struct hid_device_list_node *node = (struct hid_device_list_node *)calloc(1, sizeof(struct hid_device_list_node)); | ^~~~~~ /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/src/hidapi/mac/hid.c: In function 'PLATFORM_hid_get_feature_report': /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/src/hidapi/mac/hid.c:1091:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] 1091 | int skipped_report_id = 0; | ^~~ In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/src/hidapi/SDL_hidapi.c:578: /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/src/hidapi/mac/hid.c: In function 'create_usage_match': /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/src/hidapi/mac/hid.c:407:21: internal compiler error: in decode_addr_const, at varasm.c:3059 407 | const void *keys[2] = { (void *) CFSTR(kIOHIDDeviceUsagePageKey), (void *) CFSTR(kIOHIDDeviceUsageKey) }; | ^~~~ ``` `-save-temps` fails to produce i file, but gives the following output: ``` 36-111% sudo /opt/local/bin/gcc-mp-11 -save-temps -v -DSDL2_EXPORTS -DUSING_GENERATED_CONFIG_H -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/build/include -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/include -pipe -Os -DNDEBUG -I/opt/local/include -idirafter "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/src/video/khronos" -I/opt/local/include/libusb-1.0 -D_THREAD_SAFE -Wshadow -fvisibility=hidden -Wdeclaration-after-statement -fno-strict-aliasing -Wall -arch ppc -mmacosx-version-min=10.6 -fPIC -MD -MT CMakeFiles/SDL2.dir/src/hidapi/SDL_hidapi.c.o -MF CMakeFiles/SDL2.dir/src/hidapi/SDL_hidapi.c.o.d -o CMakeFiles/SDL2.dir/src/hidapi/SDL_hidapi.c.o -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/src/hidapi/SDL_hidapi.c gcc-mp-11: warning: '-pipe' ignored because '-save-temps' specified Using built-in specs. COLLECT_GCC=/opt/local/bin/gcc-mp-11 Target: ppc-apple-darwin10 Configured with: /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_gcc11/gcc11/work/gcc-11.3.0/configure --prefix=/opt/local --build=ppc-apple-darwin10 --enable-languages=c,c++,objc,obj-c++,lto,fortran --libdir=/opt/local/lib/gcc11 --includedir=/opt/local/include/gcc11 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-11 --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-11 --with-gxx-include-dir=/opt/local/include/gcc11/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-isl=/opt/local --with-zstd=/opt/local --enable-stage1-checking --disable-multilib --enable-lto --enable-libstdcxx-time --with-build-config=bootstrap-debug --with-bugurl=https://trac.macports.org/newticket --enable-host-shared --with-tune-cpu=G5 --disable-tls --with-as=/opt/local/bin/as --with-ld=/opt/local/bin/ld --with-ar=/opt/local/bin/ar --with-pkgversion='MacPorts gcc11 11.3.0_0' Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 11.3.0 (MacPorts gcc11 11.3.0_0) COLLECT_GCC_OPTIONS='-save-temps' '-v' '-D' 'SDL2_EXPORTS' '-D' 'USING_GENERATED_CONFIG_H' '-I' '/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/build/include' '-I' '/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/include' '-pipe' '-Os' '-D' 'NDEBUG' '-I' '/opt/local/include' '-idirafter' '/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/src/video/khronos' '-I' '/opt/local/include/libusb-1.0' '-D' '_THREAD_SAFE' '-Wshadow' '-fvisibility=hidden' '-Wdeclaration-after-statement' '-fno-strict-aliasing' '-Wall' '-fPIC' '-MD' '-MT' 'CMakeFiles/SDL2.dir/src/hidapi/SDL_hidapi.c.o' '-MF' 'CMakeFiles/SDL2.dir/src/hidapi/SDL_hidapi.c.o.d' '-o' 'CMakeFiles/SDL2.dir/src/hidapi/SDL_hidapi.c.o' '-c' '-m32' '-mmacosx-version-min=10.6' '-asm_macosx_version_min=10.6' '-nodefaultexport' '-dumpdir' 'CMakeFiles/SDL2.dir/src/hidapi/' /opt/local/libexec/gcc/ppc-apple-darwin10/11.3.0/cc1 -E -quiet -v -I /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/build/include -I /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/include -I /opt/local/include -I /opt/local/include/libusb-1.0 -MD CMakeFiles/SDL2.dir/src/hidapi/SDL_hidapi.c.d -MF CMakeFiles/SDL2.dir/src/hidapi/SDL_hidapi.c.o.d -MT CMakeFiles/SDL2.dir/src/hidapi/SDL_hidapi.c.o -D__DYNAMIC__ -D SDL2_EXPORTS -D USING_GENERATED_CONFIG_H -D NDEBUG -D _THREAD_SAFE -idirafter /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/src/video/khronos /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/src/hidapi/SDL_hidapi.c -fPIC -m32 -mmacosx-version-min=10.6 -Wshadow -Wdeclaration-after-statement -Wall -fvisibility=hidden -fno-strict-aliasing -fPIC -Os -fpch-preprocess -o CMakeFiles/SDL2.dir/src/hidapi/SDL_hidapi.c.i ignoring nonexistent directory "/opt/local/lib/gcc11/gcc/ppc-apple-darwin10/11.3.0/../../../../../ppc-apple-darwin10/include" ignoring duplicate directory "/opt/local/include" as it is a non-system directory that duplicates a system directory #include "..." search starts here: #include <...> search starts here: /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/build/include /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/include /opt/local/include/libusb-1.0 /opt/local/lib/gcc11/gcc/ppc-apple-darwin10/11.3.0/include /opt/local/include /opt/local/lib/gcc11/gcc/ppc-apple-darwin10/11.3.0/include-fixed /usr/include /System/Library/Frameworks /Library/Frameworks /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2/libsdl2/work/SDL2-2.0.22/src/video/khronos End of search list. cc1: fatal error: opening output file CMakeFiles/SDL2.dir/src/hidapi/SDL_hidapi.c.i: No such file or directory compilation terminated. ```
I am not going to be able to make any progress on this without a .i file (it is not an error that I've seen in any testing). ==== > CMakeFiles/SDL2.dir/src/hidapi/SDL_hidapi.c.i: No such file or directory Perhaps that directory has not been created at the time you are trying to run the command... please take the -save-temps command and see if you can simplify it to just get it to produce output in the current directory.
(In reply to Iain Sandoe from comment #1) > I am not going to be able to make any progress on this without a .i file (it > is not an error that I've seen in any testing). > > ==== > > > CMakeFiles/SDL2.dir/src/hidapi/SDL_hidapi.c.i: No such file or directory > > Perhaps that directory has not been created at the time you are trying to > run the command... > > please take the -save-temps command and see if you can simplify it to just > get it to produce output in the current directory. I am sorry, I stupidly ran command from a wrong directory. I produced the file now.
Created attachment 52939 [details] save-temps file
I can repeat this with the 11.3-darwin-r0 release build on powwerpc-darwin9. Do you happen to know if this previously worked with GCC 11 and/or earlier, if so please could you identify what the last known working version was. Thanks.
(In reply to Iain Sandoe from comment #4) > I can repeat this with the 11.3-darwin-r0 release build on powwerpc-darwin9. > > Do you happen to know if this previously worked with GCC 11 and/or earlier, > if so please could you identify what the last known working version was. > Thanks. Unfortunately, no. I will try to test it and provide an update in awhile. (The technical difficulty is that due to changes in libgcc, I only have 11.3.0 working on 10.6, and on 10.5.8 the port doesn’t yet build for different reasons.)
it seems to fail "forever" (at least back to 5.5) minimal reproducer: typedef const struct __CFString * CFStringRef; static void create_usage_match(const unsigned int page, const unsigned int usage, int *okay) { const void *keys[2] = { (void *) ((CFStringRef) __builtin___CFStringMakeConstantString ("" "DeviceUsagePage" "")) , (void *) ((CFStringRef) __builtin___CFStringMakeConstantString ("" "DeviceUsage" "")) }; }
(In reply to Iain Sandoe from comment #6) > it seems to fail "forever" (at least back to 5.5) > > minimal reproducer: > > typedef const struct __CFString * CFStringRef; > > static void > create_usage_match(const unsigned int page, const unsigned int usage, int > *okay) > { > > const void *keys[2] = > { (void *) ((CFStringRef) __builtin___CFStringMakeConstantString ("" > "DeviceUsagePage" "")) > , (void *) ((CFStringRef) __builtin___CFStringMakeConstantString ("" > "DeviceUsage" "")) > }; > > } Oh wow. Surprising that it never got caught until gcc11. P. S. Thank you very much for dealing with this!
(In reply to Iain Sandoe from comment #6) > it seems to fail "forever" (at least back to 5.5) Any chance of fixing this before the next update of GCC?
Just to update, GCC 12.3.0 exhibits the same error: /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2-snowleopard/libsdl2-snowleopard/work/SDL2-2.0.22/src/hidapi/mac/hid.c: In function 'create_usage_match': /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libsdl2-snowleopard/libsdl2-snowleopard/work/SDL2-2.0.22/src/hidapi/mac/hid.c:407:21: internal compiler error: in decode_addr_const, at varasm.cc:3083 407 | const void *keys[2] = { (void *) CFSTR(kIOHIDDeviceUsagePageKey), (void *) CFSTR(kIOHIDDeviceUsageKey) }; | ^~~~ Please submit a full bug report, with preprocessed source (by using -freport-bug). See <https://trac.macports.org/newticket> for instructions. make: *** [build/SDL_hidapi.lo] Error 1
The master branch has been updated by Iain D Sandoe <iains@gcc.gnu.org>: https://gcc.gnu.org/g:aecc0d4ba73d0810334b351da1e67232cea450d3 commit r14-8232-gaecc0d4ba73d0810334b351da1e67232cea450d3 Author: Iain Sandoe <iain@sandoe.co.uk> Date: Sat Jan 6 10:52:38 2024 +0000 Darwin: Fix constant CFString code-gen [PR105522]. Although this only fires for one of the Darwin sub-ports, it is latent elsewhere, it is also a regression c.f. the Darwin system compiler. In the code we imported from an earlier branch, CFString objects (which are constant aggregates) are constructed as CONST_DECLs. Although our current documentation suggests that these are reserved for enumeration values, in fact they are used elsewhere in the compiler for constants. This includes Objective-C where they are used to form NSString constants. In the particular case, we take the address of the constant and that triggers varasm.cc:decode_addr_constant, which does not currently support CONST_DECL. If there is a general intent to allow/encourage wider use of CONST_DECL, then we should fix decode_addr_constant to look through these and evaluate the initializer (a two-line patch, but I'm not suggesting it for stage-4). We also need to update the GCC internals documentation to allow for the additional uses. This patch is Darwin-local and fixes the problem by making the CFString constants into regular variable but TREE_CONSTANT+TREE_READONLY. I plan to back-port this to the open branches once it has baked a while on trunk. Since, for Darwin, the Objective-C default is to construct constant NSString objects as CFStrings; this will also cover the majority of cases there (this patch does not make any changes to Objective-C NSStrings). PR target/105522 gcc/ChangeLog: * config/darwin.cc (machopic_select_section): Handle C and C++ CFStrings. (darwin_rename_builtins): Move this out of the CFString code. (darwin_libc_has_function): Likewise. (darwin_build_constant_cfstring): Create an anonymous var to hold each CFString. * config/darwin.h (ASM_OUTPUT_LABELREF): Handle constant CFstrings. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
(In reply to GCC Commits from comment #10) > The master branch has been updated by Iain D Sandoe <iains@gcc.gnu.org>: Iain, thank you very much for addressing this!
(In reply to Sergey Fedorov from comment #11) > (In reply to GCC Commits from comment #10) > > The master branch has been updated by Iain D Sandoe <iains@gcc.gnu.org>: > > Iain, thank you very much for addressing this! If this is fixed for you, can you please move this to RESOLVED / FIXED?
fixed on trunk, intending to backport it.
(In reply to Iain Sandoe from comment #13) > fixed on trunk, intending to backport it. Great! Once it is on your branches, hopefully Macports borrows the patch as well.
(In reply to Peter Bergner from comment #12) > (In reply to Sergey Fedorov from comment #11) > > (In reply to GCC Commits from comment #10) > > > The master branch has been updated by Iain D Sandoe <iains@gcc.gnu.org>: > > > > Iain, thank you very much for addressing this! > > If this is fixed for you, can you please move this to RESOLVED / FIXED? I will need to rebuild gcc13 and try it out, allow me some time please.
(In reply to Sergey Fedorov from comment #15) > (In reply to Peter Bergner from comment #12) > > (In reply to Sergey Fedorov from comment #11) > > > (In reply to GCC Commits from comment #10) > > > > The master branch has been updated by Iain D Sandoe <iains@gcc.gnu.org>: > > > > > > Iain, thank you very much for addressing this! > > > > If this is fixed for you, can you please move this to RESOLVED / FIXED? > > I will need to rebuild gcc13 and try it out, allow me some time please. it is only fixed on trunk so far - I am currently working on back ports to earlier branches and this will be one of them - so please leave open for now.
The releases/gcc-13 branch has been updated by Iain D Sandoe <iains@gcc.gnu.org>: https://gcc.gnu.org/g:bd760ac35d792683cd82f6b665516528fe11752a commit r13-8537-gbd760ac35d792683cd82f6b665516528fe11752a Author: Iain Sandoe <iain@sandoe.co.uk> Date: Sat Jan 6 10:52:38 2024 +0000 Darwin: Fix constant CFString code-gen [PR105522]. Although this only fires for one of the Darwin sub-ports, it is latent elsewhere, it is also a regression c.f. the Darwin system compiler. In the code we imported from an earlier branch, CFString objects (which are constant aggregates) are constructed as CONST_DECLs. Although our current documentation suggests that these are reserved for enumeration values, in fact they are used elsewhere in the compiler for constants. This includes Objective-C where they are used to form NSString constants. In the particular case, we take the address of the constant and that triggers varasm.cc:decode_addr_constant, which does not currently support CONST_DECL. If there is a general intent to allow/encourage wider use of CONST_DECL, then we should fix decode_addr_constant to look through these and evaluate the initializer (a two-line patch, but I'm not suggesting it for stage-4). We also need to update the GCC internals documentation to allow for the additional uses. This patch is Darwin-local and fixes the problem by making the CFString constants into regular variable but TREE_CONSTANT+TREE_READONLY. I plan to back-port this to the open branches once it has baked a while on trunk. Since, for Darwin, the Objective-C default is to construct constant NSString objects as CFStrings; this will also cover the majority of cases there (this patch does not make any changes to Objective-C NSStrings). PR target/105522 gcc/ChangeLog: * config/darwin.cc (machopic_select_section): Handle C and C++ CFStrings. (darwin_rename_builtins): Move this out of the CFString code. (darwin_libc_has_function): Likewise. (darwin_build_constant_cfstring): Create an anonymous var to hold each CFString. * config/darwin.h (ASM_OUTPUT_LABELREF): Handle constant CFstrings. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> (cherry picked from commit aecc0d4ba73d0810334b351da1e67232cea450d3)
The releases/gcc-12 branch has been updated by Iain D Sandoe <iains@gcc.gnu.org>: https://gcc.gnu.org/g:b9ee0c8830592212678c402aed8a6b11ef8d2640 commit r12-10348-gb9ee0c8830592212678c402aed8a6b11ef8d2640 Author: Iain Sandoe <iain@sandoe.co.uk> Date: Sat Jan 6 10:52:38 2024 +0000 Darwin: Fix constant CFString code-gen [PR105522]. Although this only fires for one of the Darwin sub-ports, it is latent elsewhere, it is also a regression c.f. the Darwin system compiler. In the code we imported from an earlier branch, CFString objects (which are constant aggregates) are constructed as CONST_DECLs. Although our current documentation suggests that these are reserved for enumeration values, in fact they are used elsewhere in the compiler for constants. This includes Objective-C where they are used to form NSString constants. In the particular case, we take the address of the constant and that triggers varasm.cc:decode_addr_constant, which does not currently support CONST_DECL. If there is a general intent to allow/encourage wider use of CONST_DECL, then we should fix decode_addr_constant to look through these and evaluate the initializer (a two-line patch, but I'm not suggesting it for stage-4). We also need to update the GCC internals documentation to allow for the additional uses. This patch is Darwin-local and fixes the problem by making the CFString constants into regular variable but TREE_CONSTANT+TREE_READONLY. I plan to back-port this to the open branches once it has baked a while on trunk. Since, for Darwin, the Objective-C default is to construct constant NSString objects as CFStrings; this will also cover the majority of cases there (this patch does not make any changes to Objective-C NSStrings). PR target/105522 gcc/ChangeLog: * config/darwin.cc (machopic_select_section): Handle C and C++ CFStrings. (darwin_rename_builtins): Move this out of the CFString code. (darwin_libc_has_function): Likewise. (darwin_build_constant_cfstring): Create an anonymous var to hold each CFString. * config/darwin.h (ASM_OUTPUT_LABELREF): Handle constant CFstrings. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> (cherry picked from commit aecc0d4ba73d0810334b351da1e67232cea450d3)
The releases/gcc-11 branch has been updated by Iain D Sandoe <iains@gcc.gnu.org>: https://gcc.gnu.org/g:a1b0ace9737a40957bfb298de22066d8ee9a6603 commit r11-11385-ga1b0ace9737a40957bfb298de22066d8ee9a6603 Author: Iain Sandoe <iain@sandoe.co.uk> Date: Sat Jan 6 10:52:38 2024 +0000 Darwin: Fix constant CFString code-gen [PR105522]. Although this only fires for one of the Darwin sub-ports, it is latent elsewhere, it is also a regression c.f. the Darwin system compiler. In the code we imported from an earlier branch, CFString objects (which are constant aggregates) are constructed as CONST_DECLs. Although our current documentation suggests that these are reserved for enumeration values, in fact they are used elsewhere in the compiler for constants. This includes Objective-C where they are used to form NSString constants. In the particular case, we take the address of the constant and that triggers varasm.cc:decode_addr_constant, which does not currently support CONST_DECL. If there is a general intent to allow/encourage wider use of CONST_DECL, then we should fix decode_addr_constant to look through these and evaluate the initializer (a two-line patch, but I'm not suggesting it for stage-4). We also need to update the GCC internals documentation to allow for the additional uses. This patch is Darwin-local and fixes the problem by making the CFString constants into regular variable but TREE_CONSTANT+TREE_READONLY. I plan to back-port this to the open branches once it has baked a while on trunk. Since, for Darwin, the Objective-C default is to construct constant NSString objects as CFStrings; this will also cover the majority of cases there (this patch does not make any changes to Objective-C NSStrings). PR target/105522 gcc/ChangeLog: * config/darwin.c (machopic_select_section): Handle C and C++ CFStrings. (darwin_rename_builtins): Move this out of the CFString code. (darwin_libc_has_function): Likewise. (darwin_build_constant_cfstring): Create an anonymous var to hold each CFString. * config/darwin.h (ASM_OUTPUT_LABELREF): Handle constant CFstrings. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> (cherry picked from commit aecc0d4ba73d0810334b351da1e67232cea450d3)
fixed on open branches (needed on earlier if maintained).