Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 935411 - app-shells/bash: the printf builtin malfunctions if compiled with gcc 14
Summary: app-shells/bash: the printf builtin malfunctions if compiled with gcc 14
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL: https://gitlab.archlinux.org/archlinu...
Whiteboard:
Keywords:
Depends on:
Blocks: gcc-14 915000
  Show dependency tree
 
Reported: 2024-07-03 15:36 UTC by RumpletonBongworth
Modified: 2024-07-03 19:04 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description RumpletonBongworth 2024-07-03 15:36:37 UTC
Steps to reproduce on amd64:

1) git clone --depth 1 https://git.savannah.gnu.org/git/bash.git (fetches 5.2.26)
2) cd bash
3) ./configure
4) make -j $(nproc)
5) ./bash -c 'printf "%.0f\n" 4.3'

Using gcc-13.2.1_p20240210:

$ ./bash -c 'printf "%.0f\n" 4.3'
4

Using gcc-14.1.1_p20240622:

$ ./bash -c 'printf "%.0f\n" 4.3'
0

Using gcc-14.1.1_p20240622 and having passed --without-bash-malloc to configure:

$ ./bash -c 'printf "%.0f\n" 4.3'
111674417979417716863998323657870170342948136615117911226980288805094984749963926559840809309316340869733040396185263762230833268650141165255743780257136910409636770799441116670387966977455784549049120952463699989625327701832861394287139553363535873707091296601655939867567748719988297476637710547282665467021852883999669549763754578748898659764898704537196738152358386266850470303624970632340712645259699022283255321758059805758020670496970093367401829345384170235779767507154856619424685071935603739524829893504214698795822371127687918931997623287927140510942854209887830278629831307432080857970157502120762163902697815446860080894112078823539301459653532791162222916627424267631443264769509772911120713098800634497523655061272144848783207346054246428207519143545353607977148087054414277601543872253407033309478585226062091977513899434242115093205769775937300933454806531579629328619316007371126858317274557441617400254489478798601803268207680031104116987082781006335016151866348904891471923784710097613902383353390513134932047304117779119210017497623489596077257651540992923966991410302178591567183029369984534510935830451636839402255652208631707083142285347113196231442043986972023029308997788389319908971752966098322631109673189120759910105710256826241960722073525616496054943804091839773805712218411627644191102570162097081986898575588245751141562287074932804713867202230768954143181828062975613406407186109120510538479564865943763801436511575402840181928842701451435627967219534531659297388701322899226401374100493710205348340256440706345312694064668210364477509011386887311057431326372452183061288945339402717930309923858774003155155713183568314696331537319033264370006862835565239692872964863362796742513271617331761965455120767531197975563084906348843879093401553147180459436475218805289007902075423754535707013545984

And again ...

$ ./bash -c 'printf "%.0f\n" 4.3'
0

And again ...

$ ./bash -c 'printf "%.0f\n" 4.3'
-0

And again ...

-811428539570912883699306102603816422361871715513822740801632267806355692792368136133382093279343331658711083409909447496395974700442964654972009745090648137598098510435014371610961151713526574742376317899470027049558320681625573874531473439306359626259741896705227069074653835186306355185468540929351767083792956198956185137763807844587031455881167608314382754637120442151353981982619295549584640532163794458993603758273170743597797627650250757909282903212387014116869000796799288751247433383217940426787138423730808300408986858727560916025404698554280212073889259994051100590496779021023481452100240666900266861204316119538528106354245629645260457309228361356958606844493824

Additionally, on Arch Linux the consequence of using --without-bash-malloc appears to be that "-nan" is the result.
Comment 1 RumpletonBongworth 2024-07-03 15:37:27 UTC
Well, I should have used fold to show the long results. I didn't realise they wouldn't wrap.
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-07-03 17:00:06 UTC
Looking.
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-07-03 17:57:34 UTC
The reason that Gentoo's bash is fine is that we did extensive preparation work for GCC 14 (which was well advertised).

In particular:

commit 9c51528023c4f13a5c407e8bbf2fc6d2e0cc56a1
Author: Sam James <sam@gentoo.org>
Date:   Sat Dec 2 04:13:49 2023 +0000

    app-shells/bash: fix another configure check for modern c

    Signed-off-by: Sam James <sam@gentoo.org>

fixes the strtold check.

Arch needs to backport the modern C fixes for bash, probably for various other packages where they manifest during configure.

Chet should consider backporting the fixes too though.
Comment 4 RumpletonBongworth 2024-07-03 18:49:28 UTC
Thanks!