Hi Moritz
Thank you very much!

> On 22 Aug 2026, at 22:58, Moritz Hoffmann <[email protected]> wrote:
> 
> 
> If we want the warnings gone while keeping IPO, I would not disable the
> diagnostic globally. Per the manual sentence above the setting propagates at
> function granularity, so it is enough to put it on the affected files:
> 
> ```cmake
> if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
>   set_source_files_properties (
>     interpreter/classes/StringClass.cpp
>     interpreter/classes/StringClassBit.cpp
>     interpreter/classes/StringClassConversion.cpp
>     interpreter/classes/StringClassSub.cpp
>     PROPERTIES COMPILE_OPTIONS -Wno-stringop-overflow)
> endif ()
> ```
> 
> That keeps the diagnostic everywhere else. The manual also warns that inlining
> can move a region to another function's setting, so this wants a build to
> confirm rather than a claim from me.
> 


I tested the CMake snippet above on WSL Ubuntu 22.04.5 LTS with GCC 11.4.0.
The warning is still there, even with a linker-specific option like this:

# Extra link library definitions
target_link_libraries(rexx rexxapi ${platform_interpreter_libs} 
${CMAKE_REQUIRED_LIBRARIES})
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
    target_link_options(rexx PRIVATE
        "-Wl,-plugin-opt=-Wno-stringop-overflow")
endif ()

Build log:
[322/360] : && /usr/bin/g++ -fPIC -O3 -O3 -DNDEBUG -flto -fno-fat-lto-objects  
-Wl,-plugin-opt=-Wno-stringop-overflow -shared -Wl,-soname,librexx.so.4 -o 
lib/librexx.so.4 CMakeFiles/rexx.dir/interpreter/classes/ArrayClass.cpp.o <cut> 
CMakeFiles/rexx.dir/interpreter/platform/unix/RexxMain.cpp.o  
-Wl,-rpath,/mnt/c/jlf/local/rexxlocal/oorexx/build/official/main/trunk/ubuntu-aarch64/gcc/release/build/lib:
  lib/librexxapi.so.4  -ldl  -lrt  -lpthread  -lcrypt  -lnsl  -lresolv && :
lto-wrapper: warning: using serial compilation of 22 LTRANS jobs
/local/rexx/oorexx/official/main/trunk/interpreter/classes/StringClass.cpp: In 
member function "lower":
/local/rexx/oorexx/official/main/trunk/interpreter/classes/StringClass.cpp:1816:15:
 warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]

If Claude doesn't spot an error in my test and doesn't find a solution, I 
propose disabling IPO/LTO for GCC < 17:

if (ORX_ENABLE_IPO AND NOT CMAKE_VERSION VERSION_LESS "3.9")
  include (CheckIPOSupported)
  check_ipo_supported (RESULT ipo_supported OUTPUT ipo_output)
  if (ipo_supported)
    # Don't use IPO with GCC version < 17 because of a false-positive 
diagnostic from lto-wrapper:
    # writing 1 byte into a region of size 0 [-Wstringop-overflow=]
    if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
        AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17)
      message (STATUS "IPO is supported but is not used with GCC < 17 because 
lto-wrapper emits a false-positive diagnostic")
      set(CMAKE_INTERPROCEDURAL_OPTIMIZATION FALSE)
    # A Debug build wants to be debuggable, and cross-module inlining is the
    # opposite of that.
    elseif (CMAKE_BUILD_TYPE STREQUAL "Debug")
    ...


Test ok on WSL Ubuntu:
-- IPO is supported but is not used with GCC < 17 because lto-wrapper emits a 
false-positive diagnostic
zero warning "writing 1 byte into a region of size ..."

Test ok on macOS:
-- IPO is supported and enabled
zero warning "writing 1 byte into a region of size ..."

Tested ok on Windows 11 ARM:
-- IPO is supported and enabled
zero warning "writing 1 byte into a region of size ..."





_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to