llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

clang crashes on x86_64-linux-gnu with Assertion `power <= maxExponent' failed

Open llvmbot opened this issue 10 years ago • 9 comments

Bugzilla Link 28032
Version trunk
OS All
Reporter LLVM Bugzilla Contributor
CC @ekatz,@fhahn,@RKSimon,@slacka

Extended Description

The current clang trunk crashes when compiling the following test case on x86_64-linux-gnu in both 32-bit and 64-bit modes.

It seems to be a 3.9 regression.

$ clang-trunk -v
clang version 3.9.0 (trunk 271256)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/3.4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0
Found candidate GCC installation: /usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/6.1.0
Found candidate GCC installation: /usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.3.0
Selected GCC installation: /usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/6.1.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
$ clang-trunk abc.c -c
clang-3.9: /home/absozero/trunk/llvm/lib/Support/APFloat.cpp:469: unsigned int powerOf5(integerPart *, unsigned int): Assertion `power <= maxExponent' failed.
#0 0x00000000019c9b28 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/home/absozero/trunk/root-clang/bin/clang-3.9+0x19c9b28)
#1 0x00000000019c7d26 llvm::sys::RunSignalHandlers() (/home/absozero/trunk/root-clang/bin/clang-3.9+0x19c7d26)
#2 0x00000000019ca1fe SignalHandler(int) (/home/absozero/trunk/root-clang/bin/clang-3.9+0x19ca1fe)
#3 0x00007fbcb3301340 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x00007fbcb24b3cc9 gsignal /build/buildd/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007fbcb24b70d8 abort /build/buildd/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007fbcb24acb86 __assert_fail_base /build/buildd/eglibc-2.19/assert/assert.c:92:0
#7 0x00007fbcb24acc32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#8 0x0000000001948a33 (/home/absozero/trunk/root-clang/bin/clang-3.9+0x1948a33)
#9 0x0000000001948e66 llvm::APFloat::convertFromDecimalString(llvm::StringRef, llvm::APFloat::roundingMode) (/home/absozero/trunk/root-clang/bin/clang-3.9+0x1948e66)
#10 0x0000000003215329 clang::NumericLiteralParser::GetFloatValue(llvm::APFloat&) (/home/absozero/trunk/root-clang/bin/clang-3.9+0x3215329)
#11 0x0000000002a22808 BuildFloatingLiteral(clang::Sema&, clang::NumericLiteralParser&, clang::QualType, clang::SourceLocation) (/home/absozero/trunk/root-clang/bin/clang-3.9+0x2a22808)
#12 0x0000000002a21bb6 clang::Sema::ActOnNumericConstant(clang::Token const&, clang::Scope*) (/home/absozero/trunk/root-clang/bin/clang-3.9+0x2a21bb6)
#13 0x000000000265941c clang::Parser::ParseCastExpression(bool, bool, bool&, clang::Parser::TypeCastState) (/home/absozero/trunk/root-clang/bin/clang-3.9+0x265941c)
#14 0x0000000002655a6c clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/home/absozero/trunk/root-clang/bin/clang-3.9+0x2655a6c)
#15 0x000000000263062e clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) (/home/absozero/trunk/root-clang/bin/clang-3.9+0x263062e)
#16 0x000000000262e451 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/home/absozero/trunk/root-clang/bin/clang-3.9+0x262e451)
#17 0x0000000002616262 clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/home/absozero/trunk/root-clang/bin/clang-3.9+0x2616262)
#18 0x0000000002615c40 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/home/absozero/trunk/root-clang/bin/clang-3.9+0x2615c40)
#19 0x0000000002614d24 clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (/home/absozero/trunk/root-clang/bin/clang-3.9+0x2614d24)
#20 0x0000000002614306 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) (/home/absozero/trunk/root-clang/bin/clang-3.9+0x2614306)
#21 0x00000000026100ba clang::ParseAST(clang::Sema&, bool, bool) (/home/absozero/trunk/root-clang/bin/clang-3.9+0x26100ba)
#22 0x0000000001ef9995 clang::FrontendAction::Execute() (/home/absozero/trunk/root-clang/bin/clang-3.9+0x1ef9995)
#23 0x0000000001ec1a41 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/absozero/trunk/root-clang/bin/clang-3.9+0x1ec1a41)
#24 0x0000000001f93161 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/absozero/trunk/root-clang/bin/clang-3.9+0x1f93161)
#25 0x000000000075c66e cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/absozero/trunk/root-clang/bin/clang-3.9+0x75c66e)
#26 0x000000000075ab20 main (/home/absozero/trunk/root-clang/bin/clang-3.9+0x75ab20)
#27 0x00007fbcb249eec5 __libc_start_main /build/buildd/eglibc-2.19/csu/libc-start.c:321:0
#28 0x00000000007580a2 _start (/home/absozero/trunk/root-clang/bin/clang-3.9+0x7580a2)
Stack dump:
0.	Program arguments: /home/absozero/trunk/root-clang/bin/clang-3.9 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name abc.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -coverage-file /home/absozero/projects/reduction/crash/abc.c -resource-dir /home/absozero/trunk/root-clang/bin/../lib/clang/3.9.0 -internal-isystem /usr/local/include -internal-isystem /home/absozero/trunk/root-clang/bin/../lib/clang/3.9.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir /home/absozero/projects/reduction/crash -ferror-limit 19 -fmessage-length 172 -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o abc.o -x c abc.c
1.	abc.c:1:15: current parser token '1.822599765941237301264202966809709908199525407846781671860490243514185844316698868404780354312913602598623673673601765550983492816311016084986754037794904502741911290588965839284612631902816779878310781282991705364470159896776763634295620399977086405507759269191523027384357711224647652929859134107131311033766177730422034039629876869844113169485951406677332105978646906000108381336146016138716819515422802764897759427649606127660585581743814569231465017756926375080156642289293673283429041674526561852596994351991654293919973161250734301229733188293435228211817355121198597329430178784033567238991382109868146408875647780268422880633923323954258731625461868019756361390707976683048199722201701058526744224010988881802218954343811624517058454647275266141777302127508235524255495077624847410188087536387260798962414632082336414689612417189261074423762230826670226570449267469450539999733042497896470433541112583949046313166142066816768615182855303336355508050848493454272763408046723392787911772643228335232454643531531293780965109596419787343039866200370966335396293292123951626300857251255826009366852778238834928201530835930494150511044504376202119146906060707879263589773640814116355442997229287357516926438797713012400395859990977672075958299501751914411100177832983979385545468844204615525381872441047228160242136358061399074918180830294797604541788443627116266477614874946320275381479719120639248096909691038772952730586273980670234908845582838047130660362863656303741468826570210809843051529764599710715968724783049668698031537609151121922737670838986231019063313451704083543258772693191077504478032977705196457476311963940423579766592267743333240240281703765714192664650261238842108525475632373727317877433107392470771157555519315342195712606219652095292061187111486142303268742526232324327684859549513380259143780498498605389236533490064713713719758516195482395683839110874815487709856719069581339439277999588764225441374023269294088723635153369117449251488451426500682275202613643546970029162894292728684327495978132931525041736043811533010451689459744960487595414710801005191019738886041700330759577486347718291152510955454288346024086767479447085488381542403918701406924613770471036657700557631167438407981043720651128279219456250303615102891006541837056511748806222607397585491924343994174101644720628454377782608040907575602819446556281207664542228467047573092234645450583055317437795082417803470814703744887189896369902337382121741956042345935884612723253142155282654595436238643127962691764272518180275427113459785623180566612952410150958294158542188856129683947423205647411293537917743492822755414940264289391349206278124637261117530546227171193101163560203913770166957306596094587157942068344009717983136831735215720221516068205887802515300718418531986345165208737593665100455983750248380809061307398226468562035199351945434457763525745232868372698882470547439739824719081288307173474326042654012348179128378292897284246659521026941421904090179393555387209037739400593259788708135948191584917854112818292327284321851309301216774469081860366386269172727256532505770337882755328485250206768602685033962440104608681703661836684224002452204206988870853482747123520399893225930911094236785628778409716642043743011838124733934741815690236928243119773507801659161306391826034349899269700203318655841365557670338920830120355215775570185205187792786469651542036921770351060275981525257479972870679584955838287739201639690056010173674146269075399160226397421213763250898426455931554089138319236160118935041431135881698097569756856151568097183010770415265728455292024186273012588882570230103556461575961588201073376434110983444957690798240626580348411130361597129760906527151728611183983964634381536446177639427357139121931555391533530062229519657764088420152465761406574372912175446065297507599001278602166241607775723548756255038111682400601444043817825327317473443616363811953229538335113554317081159605178503636684677328593784523197442447541897051765917979806997287688948887762730988732373759081487505045731780962516371322797322900290800349173908511597189960698673840575246343618674510782103231548069351600625138878990205386323507195789572212187626259883382335229004257648823812072407226748034842563719900314776037846324304340753439522188214488731587587602590773979229757579537350642919246847017003831205050091766570758342092730379087533240780509450566515975521049526648559418724492221615428321368803239393940142649951760927512806206735517233312085779604538769249237553405647014530167135901660283246967512310859858842402221675933473345262633030379166095265903616282750945146877129795473716570192167683486699408449626849151059958071445815502674667686079002889972264588367943596990204644237310847295151549276191188484721182593011565492753911808835025595944507675739829889338066224835821007529770219118651961451528039534172317720138386282712972164963827453131476237777875456011939712318010731021660815714182837925932827450846737171705703110453775045022844794161968407337563051732200611864029092524160237625633441437649560291126545016588941837216171906367061961021463277454274115736642674786105481144944900497013266814660732350276014695758646527598109032833625638118745064603049207169451605471244451396126962333970541136633781764326931671721743247881200204989497992526041155365138538482621423139201284142593682794438326622711523602971739306465982105646744687059782875743393602442251153756186461986559595562807034378047263446391660844015155450279012841727725949243700569657645371738730960512993952666118149699429724469371043743658144365355534376381724696183448618129498545588498126642153343817727180931089703595826077621825309785860116064312065392702465283402514616635687773126656643723142906109980782511327255186935290824107395569585435485254537079360983816712735775257900749095553608138810346173507117456763692906082417237501003549701061495719771391990992463590650334801645095247553097892124265649870131353053399169286761988682620470646847607094337816357723540686126275511490960625562837565919605037066143014810721631063572936011202157129109627803207640109222537327017395057537779256687211376808594099192965582405091408501397086139901514101043283540633726674670672748194619689888247209511150521033993300250522733475002028567363467073845839015993349422685149993533692203655168716914058257415372687245380085836076489297520175702786263261513025607546854950283936784192621287273192504283869131975766338274647178208782898885797819248359574788902108145946062770527573586861872495878334836229510687555644377062686459197208988121546514107351664693015899656974767580671946360204523032504979490489473998831272757332097131048832648621306183984383000314587327943545412181791826921829490138783015643214814238159286457522911947902913005066356488917209306734144416494273688587275398401286574342126647086142528388913463688579029323572701778860616756001247718669706999421391299855093107861718979077137670254905536174520523241903142304436697137859439295209346404644166711761390620349487220914939651897120727926388356660677435323625547360337786161394223954389389446058117065808804208366140493746570665942463930129662196390627893075445929601748606307958202499548533889369957428980652942467339381021757760595290949128312317978915463905710577496069993499968101815574926186401282157448075874663202214386004125214284669164849080925085632705713354056861779162529531435753356419230493015573530175745753158006266269396677249772833504763786905446024002326226226069844394696456469125944170649061117616430569366951576780483646052120595473175258384884652515381193454199796277521596118034639745612232913342101656040627715925878170617283456986294695300779325415218701022797603844998079798772855904101844159056459473830831057901459789318201715161520805009031848353610624913191857631694425153709234711986743373504616972518110450759092883471366918423063408319079172524391364120625639910155096611756479555514942001115285844108427141128936609315872225475276163714476269074772631389944912199514256566104319316535301067761376038330783936236162562837145634440924550708191351823725714116423996666078590397007518182680822944073177874683075104542728594593616393199792939970840185174070552702371149226248947684643596987248070222838650635701794832911455548416476010590671785568478803908159171377885280203284960130816983201742060839934771342421843454177186844218984341762861833060742973973373943786358180400348221408237056796733053044602089777338572687291218981332309441509314343755039755626278001120894173142009875431996141953256786162959026732040321760766077412537410119538995389503534794017014809781095208373679856442042162260799339089445093204725740343390866588412460138417501238761743046793481866577712245948787747925774763517269168847157476528582009607513335386955498721639880002645320755792353596613175635835219887570538276316368083058805697467162836871941182759159280604470776465814562568399855787289458370511793625714499473481591205825277202103208168243709328052666519272886980095474801425048104284542615114354447437288761756279140986696480631960828081981684694205881738194312976203450759136706518534321691775141481118864597950894299696438325543299924611997129572629620239692190328901749029359531264503669714158114998878449928856058461379341535853736467787249622489209894085669234235875562651930455794644700403318601460214744959935131707975830444487717413652148725681162526346741000762421585614539233955268956569057729313306012485365449757557150957640806964619664675750524929612637282053923409056469169580654471576602558825858190234231148096941222146685242184265048449406389486589142456399275122623031705959241319130847014622636645823353665797337606714079377636941219178980122532025507944459270900569885809871610702518898642834740727905326660004452107998798987953695756013107010006005067353768387113818238790459083753925242598532663195545585725881875618806369749234255004527740012548007992790884685089828390575653282976295050988699167592521318840991153224206861088947832645151398111502099263039571552035003937270274110791173694789370953847120036374066930411684565325903810218050483711078964535952030992938126627146374050250745688288225578806971071577080233831770451079327939857616370951232609530602233034699771768811872663462865067598423791655120150068450411848330556029574474625795186054539082653162229058836483798003442805597137006557342037027090559214142005150246501679352515095014024360613766491035976911451279229342670800644034673267957451959484813619478148869699426735577550966697718734964429182302662498553172686513178236442838009305515598853210612191656717860412811108032276121357378133448066756387125735225403303267524644423863799006207505881985449471137991554931339017930009178349349682295047976692398330506490102685887034086355679994831062253659247250963448491064073545964404715491846754314002476460544975667945044647304892282461711772387638463741293238063530671434535471056841014058743507762050128559983705197885505633530557061512971186030938750397081284373471871281592504026318288871453343113735525572236896283639085600117688951315352941610550446421752261874153423243206777630669111814199801498554161044899315294894586598335471728905486124973447798086405950962299377052511061631386583082347892746250089584421636436549943844913465914533379999403401028225456633159501820584108048772899363279816807047692120594176896502188717868181049930125303933597827970762762208964199390089675673427653193145026697275263799724815197422778112468222388997673988525624999e-4951L'
clang-3.9: error: unable to execute command: Aborted (core dumped)
clang-3.9: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 3.9.0 (trunk 271256)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-3.9: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script.
clang-3.9: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-3.9: note: diagnostic msg: /tmp/abc-67ee29.c
clang-3.9: note: diagnostic msg: /tmp/abc-67ee29.sh
clang-3.9: note: diagnostic msg:

********************

$ cat abc.c
long double a=1.822599765941237301264202966809709908199525407846781671860490243514185844316698868404780354312913602598623673673601765550983492816311016084986754037794904502741911290588965839284612631902816779878310781282991705364470159896776763634295620399977086405507759269191523027384357711224647652929859134107131311033766177730422034039629876869844113169485951406677332105978646906000108381336146016138716819515422802764897759427649606127660585581743814569231465017756926375080156642289293673283429041674526561852596994351991654293919973161250734301229733188293435228211817355121198597329430178784033567238991382109868146408875647780268422880633923323954258731625461868019756361390707976683048199722201701058526744224010988881802218954343811624517058454647275266141777302127508235524255495077624847410188087536387260798962414632082336414689612417189261074423762230826670226570449267469450539999733042497896470433541112583949046313166142066816768615182855303336355508050848493454272763408046723392787911772643228335232454643531531293780965109596419787343039866200370966335396293292123951626300857251255826009366852778238834928201530835930494150511044504376202119146906060707879263589773640814116355442997229287357516926438797713012400395859990977672075958299501751914411100177832983979385545468844204615525381872441047228160242136358061399074918180830294797604541788443627116266477614874946320275381479719120639248096909691038772952730586273980670234908845582838047130660362863656303741468826570210809843051529764599710715968724783049668698031537609151121922737670838986231019063313451704083543258772693191077504478032977705196457476311963940423579766592267743333240240281703765714192664650261238842108525475632373727317877433107392470771157555519315342195712606219652095292061187111486142303268742526232324327684859549513380259143780498498605389236533490064713713719758516195482395683839110874815487709856719069581339439277999588764225441374023269294088723635153369117449251488451426500682275202613643546970029162894292728684327495978132931525041736043811533010451689459744960487595414710801005191019738886041700330759577486347718291152510955454288346024086767479447085488381542403918701406924613770471036657700557631167438407981043720651128279219456250303615102891006541837056511748806222607397585491924343994174101644720628454377782608040907575602819446556281207664542228467047573092234645450583055317437795082417803470814703744887189896369902337382121741956042345935884612723253142155282654595436238643127962691764272518180275427113459785623180566612952410150958294158542188856129683947423205647411293537917743492822755414940264289391349206278124637261117530546227171193101163560203913770166957306596094587157942068344009717983136831735215720221516068205887802515300718418531986345165208737593665100455983750248380809061307398226468562035199351945434457763525745232868372698882470547439739824719081288307173474326042654012348179128378292897284246659521026941421904090179393555387209037739400593259788708135948191584917854112818292327284321851309301216774469081860366386269172727256532505770337882755328485250206768602685033962440104608681703661836684224002452204206988870853482747123520399893225930911094236785628778409716642043743011838124733934741815690236928243119773507801659161306391826034349899269700203318655841365557670338920830120355215775570185205187792786469651542036921770351060275981525257479972870679584955838287739201639690056010173674146269075399160226397421213763250898426455931554089138319236160118935041431135881698097569756856151568097183010770415265728455292024186273012588882570230103556461575961588201073376434110983444957690798240626580348411130361597129760906527151728611183983964634381536446177639427357139121931555391533530062229519657764088420152465761406574372912175446065297507599001278602166241607775723548756255038111682400601444043817825327317473443616363811953229538335113554317081159605178503636684677328593784523197442447541897051765917979806997287688948887762730988732373759081487505045731780962516371322797322900290800349173908511597189960698673840575246343618674510782103231548069351600625138878990205386323507195789572212187626259883382335229004257648823812072407226748034842563719900314776037846324304340753439522188214488731587587602590773979229757579537350642919246847017003831205050091766570758342092730379087533240780509450566515975521049526648559418724492221615428321368803239393940142649951760927512806206735517233312085779604538769249237553405647014530167135901660283246967512310859858842402221675933473345262633030379166095265903616282750945146877129795473716570192167683486699408449626849151059958071445815502674667686079002889972264588367943596990204644237310847295151549276191188484721182593011565492753911808835025595944507675739829889338066224835821007529770219118651961451528039534172317720138386282712972164963827453131476237777875456011939712318010731021660815714182837925932827450846737171705703110453775045022844794161968407337563051732200611864029092524160237625633441437649560291126545016588941837216171906367061961021463277454274115736642674786105481144944900497013266814660732350276014695758646527598109032833625638118745064603049207169451605471244451396126962333970541136633781764326931671721743247881200204989497992526041155365138538482621423139201284142593682794438326622711523602971739306465982105646744687059782875743393602442251153756186461986559595562807034378047263446391660844015155450279012841727725949243700569657645371738730960512993952666118149699429724469371043743658144365355534376381724696183448618129498545588498126642153343817727180931089703595826077621825309785860116064312065392702465283402514616635687773126656643723142906109980782511327255186935290824107395569585435485254537079360983816712735775257900749095553608138810346173507117456763692906082417237501003549701061495719771391990992463590650334801645095247553097892124265649870131353053399169286761988682620470646847607094337816357723540686126275511490960625562837565919605037066143014810721631063572936011202157129109627803207640109222537327017395057537779256687211376808594099192965582405091408501397086139901514101043283540633726674670672748194619689888247209511150521033993300250522733475002028567363467073845839015993349422685149993533692203655168716914058257415372687245380085836076489297520175702786263261513025607546854950283936784192621287273192504283869131975766338274647178208782898885797819248359574788902108145946062770527573586861872495878334836229510687555644377062686459197208988121546514107351664693015899656974767580671946360204523032504979490489473998831272757332097131048832648621306183984383000314587327943545412181791826921829490138783015643214814238159286457522911947902913005066356488917209306734144416494273688587275398401286574342126647086142528388913463688579029323572701778860616756001247718669706999421391299855093107861718979077137670254905536174520523241903142304436697137859439295209346404644166711761390620349487220914939651897120727926388356660677435323625547360337786161394223954389389446058117065808804208366140493746570665942463930129662196390627893075445929601748606307958202499548533889369957428980652942467339381021757760595290949128312317978915463905710577496069993499968101815574926186401282157448075874663202214386004125214284669164849080925085632705713354056861779162529531435753356419230493015573530175745753158006266269396677249772833504763786905446024002326226226069844394696456469125944170649061117616430569366951576780483646052120595473175258384884652515381193454199796277521596118034639745612232913342101656040627715925878170617283456986294695300779325415218701022797603844998079798772855904101844159056459473830831057901459789318201715161520805009031848353610624913191857631694425153709234711986743373504616972518110450759092883471366918423063408319079172524391364120625639910155096611756479555514942001115285844108427141128936609315872225475276163714476269074772631389944912199514256566104319316535301067761376038330783936236162562837145634440924550708191351823725714116423996666078590397007518182680822944073177874683075104542728594593616393199792939970840185174070552702371149226248947684643596987248070222838650635701794832911455548416476010590671785568478803908159171377885280203284960130816983201742060839934771342421843454177186844218984341762861833060742973973373943786358180400348221408237056796733053044602089777338572687291218981332309441509314343755039755626278001120894173142009875431996141953256786162959026732040321760766077412537410119538995389503534794017014809781095208373679856442042162260799339089445093204725740343390866588412460138417501238761743046793481866577712245948787747925774763517269168847157476528582009607513335386955498721639880002645320755792353596613175635835219887570538276316368083058805697467162836871941182759159280604470776465814562568399855787289458370511793625714499473481591205825277202103208168243709328052666519272886980095474801425048104284542615114354447437288761756279140986696480631960828081981684694205881738194312976203450759136706518534321691775141481118864597950894299696438325543299924611997129572629620239692190328901749029359531264503669714158114998878449928856058461379341535853736467787249622489209894085669234235875562651930455794644700403318601460214744959935131707975830444487717413652148725681162526346741000762421585614539233955268956569057729313306012485365449757557150957640806964619664675750524929612637282053923409056469169580654471576602558825858190234231148096941222146685242184265048449406389486589142456399275122623031705959241319130847014622636645823353665797337606714079377636941219178980122532025507944459270900569885809871610702518898642834740727905326660004452107998798987953695756013107010006005067353768387113818238790459083753925242598532663195545585725881875618806369749234255004527740012548007992790884685089828390575653282976295050988699167592521318840991153224206861088947832645151398111502099263039571552035003937270274110791173694789370953847120036374066930411684565325903810218050483711078964535952030992938126627146374050250745688288225578806971071577080233831770451079327939857616370951232609530602233034699771768811872663462865067598423791655120150068450411848330556029574474625795186054539082653162229058836483798003442805597137006557342037027090559214142005150246501679352515095014024360613766491035976911451279229342670800644034673267957451959484813619478148869699426735577550966697718734964429182302662498553172686513178236442838009305515598853210612191656717860412811108032276121357378133448066756387125735225403303267524644423863799006207505881985449471137991554931339017930009178349349682295047976692398330506490102685887034086355679994831062253659247250963448491064073545964404715491846754314002476460544975667945044647304892282461711772387638463741293238063530671434535471056841014058743507762050128559983705197885505633530557061512971186030938750397081284373471871281592504026318288871453343113735525572236896283639085600117688951315352941610550446421752261874153423243206777630669111814199801498554161044899315294894586598335471728905486124973447798086405950962299377052511061631386583082347892746250089584421636436549943844913465914533379999403401028225456633159501820584108048772899363279816807047692120594176896502188717868181049930125303933597827970762762208964199390089675673427653193145026697275263799724815197422778112468222388997673988525624999e-4951L;

llvmbot avatar Jun 07 '16 06:06 llvmbot

*** #31318 was marked as a duplicate of this bug ***

RKSimon avatar Nov 26 '21 22:11 RKSimon

On second thought, assert should not occur...

ekatz avatar Oct 31 '19 22:10 ekatz

This assert seems legit. And in turn an Underflow occurs. We may remove the assert, and just let the underflow occur, or we can warn about it. I think we should leave this assert, as it only occurs on DEBUG (as it should).

ekatz avatar Oct 31 '19 18:10 ekatz

Thanks for looking into this!

From your comment, it sounds like this is still a problem in upstream LLVM/Clang. I would suggest you try to take a look at the code raising the assertion and investigate what a possible fix would be. It might be worthwhile to check why the assertion has been added. It could also be that the parsing code in Clang changed, surfacing the assertion.

The reason pre-built Clang binaries do not show this problem could be that they are release builds without assertions.

fhahn avatar Dec 25 '17 12:12 fhahn

I did some research on this bug and it seems strange. I can reproduce this bug on clang that build from source clang version 3.9.1 (http://llvm.org/git/clang.git 54f5752c3600d39ee8de62ba9ff304154baf5e80) (http://llvm.org/git/llvm.git a093ef43dd592b729da46db4ff3057fef9a46023) or clang version 6.0.0 (http://llvm.org/git/clang.git 5d0a3f5731c3fe447fac3f2cb9a75f0a622714cf) (http://llvm.org/git/llvm.git 93903a5279559ac62f998b70b3f53a84533cc7ee))

But clang built from binaries executes just fine Apple LLVM version 9.0.0 (clang-900.0.38) (Xcode) or clang version 3.9.1 (tags/RELEASE_391/final) (homebrew)

As it appears this can be reproduced on Target: x86_64-apple-darwin16.7.0

I guess I need some help here.

llvmbot avatar Nov 14 '17 13:11 llvmbot

*** Bug llvm/llvm-bugzilla-archive#31970 has been marked as a duplicate of this bug. ***

RKSimon avatar Apr 03 '17 18:04 RKSimon

@llvm/issue-subscribers-clang-frontend

llvmbot avatar Jun 14 '23 21:06 llvmbot

Hi!

This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:

  1. Assign the issue to you.
  2. Fix the issue locally.
  3. Run the test suite locally. 3.1) Remember that the subdirectories under test/ create fine-grained testing targets, so you can e.g. use make check-clang-ast to only run Clang's AST tests.
  4. Create a git commit
  5. Run git clang-format HEAD~1 to format your changes.
  6. Submit the patch to Phabricator. 6.1) Detailed instructions can be found here

For more instructions on how to submit a patch to LLVM, see our documentation.

If you have any further questions about this issue, don't hesitate to ask via a comment on this Github issue.

@llvm/issue-subscribers-good-first-issue

llvmbot avatar Jun 14 '23 21:06 llvmbot

Ok so the issue happens with floating point constants with many digits after the decimal, with an exponent with magnitude less than 4951 and the count of the digits and the magnitude of the exponent together are greater than 16383, which comes from https://github.com/llvm/llvm-project/blob/34bd7e229d8262783a64401814dc0b6bcdf1b8af/llvm/lib/Support/APFloat.cpp#L285

Which means the range of bad inputs are in the form of 1.([0]*16383)1 https://godbolt.org/z/oP49n6a9W to 1.1.([0]*11432)1e-4951 https://godbolt.org/z/PdeMKG4xo and you can just range the number of digits between the dot and the last non zero digit with the magnitude of the number in the exponent

wheatman avatar Jul 15 '23 14:07 wheatman