Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GCC12] argument value ... exceeds maximum object size #41795

Closed
iarspider opened this issue May 30, 2023 · 11 comments
Closed

[GCC12] argument value ... exceeds maximum object size #41795

iarspider opened this issue May 30, 2023 · 11 comments

Comments

@iarspider
Copy link
Contributor

GCC12 emits Walloc-size-larger-than compilation warnings in SimG4CMS 1, 2, 3, and in DQM 4:

.../external/gcc/12.2.1-59043c7bdcfa6002a8c9155ca1109454/bin/c++ -O2 -pthread -pipe -Werror=main -Werror=pointer-arith -Werror=overlength-strings -Wno-vla -Werror=overflow -std=c++17 -ftree-vectorize -Werror=array-bounds -Werror=format-contains-nul -Werror=type-limits -fvisibility-inlines-hidden -fno-math-errno --param vect-max-version-for-alias-checks=50 -Xassembler --compress-debug-sections -Wno-error=array-bounds -Warray-bounds -fuse-ld=bfd -msse3 -felide-constructors -fmessage-length=0 -Wall -Wno-non-template-friend -Wno-long-long -Wreturn-type -Wextra -Wpessimizing-move -Wclass-memaccess -Wno-cast-function-type -Wno-unused-but-set-parameter -Wno-ignored-qualifiers -Wno-deprecated-copy -Wno-unused-parameter -Wunused -Wparentheses -Wno-deprecated -Werror=return-type -Werror=missing-braces -Werror=unused-value -Werror=unused-label -Werror=address -Werror=format -Werror=sign-compare -Werror=write-strings -Werror=delete-non-virtual-dtor -Werror=strict-aliasing -Werror=narrowing -Werror=unused-but-set-variable -Werror=reorder -Werror=unused-variable -Werror=conversion-null -Werror=return-local-addr -Wnon-virtual-dtor -Werror=switch -fdiagnostics-show-option -Wno-unused-local-typedefs -Wno-attributes -Wno-psabi -Wno-error=unused-variable -ftls-model=global-dynamic -pthread -DBOOST_DISABLE_ASSERTS -flto -fipa-icf -flto-odr-type-merging -fno-fat-lto-objects -Wodr -shared -Wl,-E -Wl,-z,defs tmp/el8_amd64_gcc12/src/SimG4CMS/FP420/src/SimG4CMSFP420/FP420G4Hit.cc.o tmp/el8_amd64_gcc12/src/SimG4CMS/FP420/src/SimG4CMSFP420/FP420HitsObject.cc.o tmp/el8_amd64_gcc12/src/SimG4CMS/FP420/src/SimG4CMSFP420/FP420NumberingScheme.cc.o tmp/el8_amd64_gcc12/src/SimG4CMS/FP420/src/SimG4CMSFP420/FP420SD.cc.o -o tmp/el8_amd64_gcc12/src/SimG4CMS/FP420/src/SimG4CMSFP420/libSimG4CMSFP420.so -Wl,-E -Wl,--hash-style=gnu -L.../CMSSW_13_2_X_2023-05-29-1100/biglib/el8_amd64_gcc12 -L.../CMSSW_13_2_X_2023-05-29-1100/lib/el8_amd64_gcc12 -L.../CMSSW_13_2_X_2023-05-29-1100/external/el8_amd64_gcc12/lib -L.../CMSSW_13_2_X_2023-05-29-1100/static/el8_amd64_gcc12 -lSimG4CoreSensitiveDetector -lSimDataFormatsSimHitMaker -lSimG4CoreGeometry -lDetectorDescriptionCore -lDetectorDescriptionDDCMS -lSimDataFormatsTrackingHit -lSimG4CoreNotification -lDataFormatsGeometryVector -lFWCoreFramework -lSimDataFormatsCaloHit -lSimDataFormatsTrack -lSimDataFormatsVertex -lDataFormatsMath -lFWCoreCommon -lFWCoreServiceRegistry -lSimDataFormatsForward -lDataFormatsCommon -lFWCoreParameterSet -lFWCoreMessageLogger -lDataFormatsProvenance -lFWCorePluginManager -lFWCoreReflection -lFWCoreConcurrency -lFWCoreUtilities -lFWCoreVersion -lSimDataFormatsEncodedEventId -lDDAlign -lDDCond -lDDG4-static -lDDCore -lDDParsers -lPhysics -lHist -lMatrix -lGenVector -lMathMore -lTree -lNet -lGeom -lThread -lG4digits_hits -lG4error_propagation -lG4event -lG4geometry -lG4global -lG4graphics_reps -lG4intercoms -lG4interfaces -lG4materials -lG4parmodels -lG4particles -lG4persistency -lG4physicslists -lG4processes -lG4readout -lG4run -lG4tracking -lG4track -lG4analysis -lMathCore -lRIO -lCore -lboost_thread -lboost_date_time -lCLHEP -lHepMCfio -lHepMC -lpcre -lvecgeom -lbz2 -lexpat -lgsl -luuid -ltbb -lxerces-c -llzma -lz -lfmt -lcms-md5 -lopenblas -lcrypt -ldl -lrt -lstdc++fs -ltinyxml2
.../CMSSW_13_2_X_2023-05-29-1100/src/SimG4CMS/FP420/src/FP420NumberingScheme.cc: In member function 'getUnitID':
  .../CMSSW_13_2_X_2023-05-29-1100/src/SimG4CMS/FP420/src/FP420NumberingScheme.cc:58:40: warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
    58 |     G4String* name = new G4String[level];
      |                                        ^
.../external/gcc/12.2.1-59043c7bdcfa6002a8c9155ca1109454/include/c++/12.2.1/new:128:26: note: in a call to allocation function 'operator new []' declared here
  128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                          ^

These could be false-positives though, as I don't think the lines in question will ever ask for 2^64-1 bytes of memory...

@cmsbuild
Copy link
Contributor

A new Issue was created by @iarspider .

@Dr15Jones, @perrotta, @dpiparo, @rappoccio, @makortel, @smuzaffar can you please review it and eventually sign/assign? Thanks.

cms-bot commands are listed here

@iarspider
Copy link
Contributor Author

assign simulation,dqm

@cmsbuild
Copy link
Contributor

New categories assigned: dqm,simulation

@mdhildreth,@tjavaid,@micsucmed,@nothingface0,@rvenditti,@emanueleusai,@syuvivida,@civanch,@pmandrik you have been requested to review this Pull request/Issue and eventually sign? Thanks

@makortel
Copy link
Contributor

All the warnings seem to be related to C-arrays of G4String or std::string.

@iarspider
Copy link
Contributor Author

I would imagine that level somehow gets set to -1, but the code that triggers warning is explicitly guarded by if level>0

@makortel
Copy link
Contributor

On a quick look the pieces of code look like replacing the C-arrays with std::vectors would make them more clear and concise anyway, and I'd hope moving to std::vector would silence this warning as well.

@VinInn
Copy link
Contributor

VinInn commented May 30, 2023

seems to be lto related

@civanch
Copy link
Contributor

civanch commented May 30, 2023

Yes it is LTO, which has a problem if there is a complex code with C-arrays of unclear size. We have observed similar crazy report on Geant4. When migration to std::vector is done the warning disappears and code become more readable. I suspect that LTO simply confused.

@VinInn
Copy link
Contributor

VinInn commented May 30, 2023

and can be reproduced only if -1 is explicitly "converted in unsigned (something that lto may do)

@VinInn
Copy link
Contributor

VinInn commented May 30, 2023

@civanch
Copy link
Contributor

civanch commented Jun 1, 2023

+1

it is likely a problem of LTO in gcc12 but code itself was more complicate than needed. Now no C arrays.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants