From patchwork Wed Jun 13 16:07:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 27806 Received: (qmail 25432 invoked by alias); 13 Jun 2018 16:07:19 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 25417 invoked by uid 89); 13 Jun 2018 16:07:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.0 required=5.0 tests=GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS, TIME_LIMIT_EXCEEDED, URIBL_RED autolearn=unavailable version=3.3.2 spammy=duo, fno, H*c:HHHHH X-HELO: relay1.mentorg.com Date: Wed, 13 Jun 2018 16:07:00 +0000 From: Joseph Myers To: Subject: Fix strtod overflow detection (bug 23279) [committed] Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) As shown by bug 23279, strtod's round_and_return has an off-by-one error in its overflow detection, only counting an exponent greater than MAX_EXP as overflowing when an exponent of MAX_EXP also means overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on a floating-point model where 2^exp is multiplied by a value in the interval [0.5, 1), so 2^MAX_EXP is not representable). For decimal arguments to strtod, a separate overflow check in the main implementation covers the case where the integer part of the argument (truncated to the nearest integer towards zero) has more than MAX_EXP bits, meaning that this issue in round_and_return only affects cases (arguments with absolute value strictly between the maximum representable value and 2^MAX_EXP) where overflow depends on the rounding mode; in such cases, the returned value would still have been correct on overflow but without the overflow exception being raised or errno being set to ERANGE. For hex float arguments, however, other cases can arise, as shown in bug 23279, where a value with exponent already set to MAX_EXP is passed into round_and_return and a result can wrongly end up being NaN, or infinity instead of the largest finite value. This patch fixes the off-by-one error, adds testing of overflow exceptions to the tst-strtod-round framework, and adds tests of these issues. Tested for x86_64. Also ran the tst-strtod-round tests for powerpc to make sure the new tests didn't introduce any new failures for IBM long double. (Generated file diffs omitted below.) 2018-06-13 Joseph Myers [BZ #23279] * stdlib/strtod_l.c (round_and_return): Handle an exponent of MAX_EXP as overflowing. * stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR overflow flag. (round_str): Output also whether result overflows in each rounding mode. * stdlib/tst-strtod-round-data: Add more tests. * stdlib/tst-strtod-round-data.h: Regenerated. * stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment. (TEST): Handle extra arguments for overflow flags. (struct test_overflow): New type. [!FE_OVERFLOW] (FE_OVERFLOW): Define to 0. (GEN_ONE_TEST): Clear all exceptions. Test overflow flag. (test_in_one_mode): Take argument with overflow information. (do_test): Update calls to test_in_one_mode. diff --git a/stdlib/gen-tst-strtod-round.c b/stdlib/gen-tst-strtod-round.c index a8f1c60..df9dcaf 100644 --- a/stdlib/gen-tst-strtod-round.c +++ b/stdlib/gen-tst-strtod-round.c @@ -45,6 +45,7 @@ static int string_to_fp (mpfr_t f, const char *s, mpfr_rnd_t rnd) { + mpfr_clear_overflow (); #ifdef WORKAROUND mpfr_t f2; mpfr_init2 (f2, 100000); @@ -73,34 +74,45 @@ static void round_str (FILE *fout, const char *s, int prec, int emin, int emax, bool ibm_ld) { + mpfr_t max_value; mpfr_t f; mpfr_set_default_prec (prec); mpfr_set_emin (emin); mpfr_set_emax (emax); mpfr_init (f); int r = string_to_fp (f, s, MPFR_RNDD); + bool overflow = mpfr_overflow_p () != 0; if (ibm_ld) { assert (prec == 106 && emin == -1073 && emax == 1024); /* The maximum value in IBM long double has discontiguous mantissa bits. */ - mpfr_t max_value; mpfr_init2 (max_value, 107); mpfr_set_str (max_value, "0x1.fffffffffffff7ffffffffffffcp+1023", 0, MPFR_RNDN); if (mpfr_cmpabs (f, max_value) > 0) - r = 1; - mpfr_clear (max_value); + { + r = 1; + overflow = true; + } } mpfr_fprintf (fout, "\t%s,\n", r ? "false" : "true"); - print_fp (fout, f, ",\n"); + print_fp (fout, f, overflow ? ", true,\n" : ", false,\n"); string_to_fp (f, s, MPFR_RNDN); - print_fp (fout, f, ",\n"); + overflow = (mpfr_overflow_p () != 0 + || (ibm_ld && mpfr_cmpabs (f, max_value) > 0)); + print_fp (fout, f, overflow ? ", true,\n" : ", false,\n"); string_to_fp (f, s, MPFR_RNDZ); - print_fp (fout, f, ",\n"); + overflow = (mpfr_overflow_p () != 0 + || (ibm_ld && mpfr_cmpabs (f, max_value) > 0)); + print_fp (fout, f, overflow ? ", true,\n" : ", false,\n"); string_to_fp (f, s, MPFR_RNDU); - print_fp (fout, f, ""); + overflow = (mpfr_overflow_p () != 0 + || (ibm_ld && mpfr_cmpabs (f, max_value) > 0)); + print_fp (fout, f, overflow ? ", true" : ", false"); mpfr_clear (f); + if (ibm_ld) + mpfr_clear (max_value); } static void diff --git a/stdlib/strtod_l.c b/stdlib/strtod_l.c index e1e9c13..a09b093 100644 --- a/stdlib/strtod_l.c +++ b/stdlib/strtod_l.c @@ -310,7 +310,7 @@ round_and_return (mp_limb_t *retval, intmax_t exponent, int negative, } } - if (exponent > MAX_EXP) + if (exponent >= MAX_EXP) goto overflow; bool half_bit = (round_limb & (((mp_limb_t) 1) << round_bit)) != 0; @@ -343,7 +343,7 @@ round_and_return (mp_limb_t *retval, intmax_t exponent, int negative, exponent = MIN_EXP - 1; } - if (exponent > MAX_EXP) + if (exponent >= MAX_EXP) overflow: return overflow_value (negative); diff --git a/stdlib/tst-strtod-round-data b/stdlib/tst-strtod-round-data index cb90803..8a898dd 100644 --- a/stdlib/tst-strtod-round-data +++ b/stdlib/tst-strtod-round-data @@ -148,3 +148,10 @@ -3.237587559719012555462219479113823276249784669017340504844942194598519770062059685508835745638324970127939070738424059838293609943191271023342555035986308991521396355375667467208367312819235870119724263252776995195727778126085574034035411017344128491238136414394551514178668780674015531193282296319913113495953953933831631032855605791532328598034154166422617226534880263244723830482289656875701701315902175019974435037627824356684033058939701577883356651733717468531204705842607568803666569711421917525834491783583598401321476176752039857173551930268891446850107760584333855521475305010940756813993214730850216669600967698749412592167692757446422169965426483919224341062751152057061076522973232731542382055087239368522167656194830741819605276971705738272393130698937532095725613383807312946395184980707534803490003540251394324459987958400939111001126190861523615485938285497714410609640798273816511769391568591823198476415765275534341709798367687043373145262933998108452661682659942586304978413812755518166239176614473815940025342279575304159493260770068030636885746695206392378276051948759263882079389379666940357441139816661913198656187703463519723262653223919257185751827493927586153153792077729913353547954808876263400200663495414360816863385220457719546338953323399286762099558324132103460225580066817535680886906060858264089074120360391613368274811868067637495154569071591624185979937989402513750464346904036668477876379544221432800037599944499161940321774835027752710681217554286366043661491013593886229615614494736186475932160549630939390542165126494166960681499481651861215529870984381726203476917507560266886692644952355421814201350137351435237036912624414444992497142303802423605897110605364956579914507108584002230524766331348271456591814078599780820974961968314684496428310691542272663818486132771177670874927831510002443658417608078383611526899905533629456904234997116303929427262032216072887961072267850618234492852606488522739744757845004694461812790342894353802938671928834585447328398711684245164703625580196678024410303542544534512706792134908369873605619756775207191558754413381571756431003248529020572648048946458999967788526617126349345966896362376841092268841417781414969315002419192181972121568811432459128737128140063645558482525300089060238860392371092102688097987915838860882370022268312322882235690785726190915062699382576041643741555139697348927957856990969985342299599797431503615312038393069808777315725367497595040966093808407117316369389112216628231869173217637452855462790553030636920487796465880633399632793882734473382168542596184679158149228725004404714293460752371865436947855237307240001863573081174929166645758276081272685156100195420794154740486637315823136798695124738873328565945598241199335059398955049459449844741098478330319112865980346771381982151154499846478545530650091824164892591396650703633600023191521502618379988693800703884555191647864959327260468892793195316578510173816406054364319294906641284764788384683586662382042642852654156477478700779123584369965723284711409361741235548687181052639639279285373139084165798451899763979500837428077782309910703522399860010310321116623028924118238023770381424894162717815296210097245221769714495449744327945091943394325259297771090128969600269822520904193880119094781214175887316220311309028456568749910010962366586834018403242866721783519806933018588077977626913774236680220258524711348037750591646286531625306510583751929280541119187219596706615736304036444366663256426643903386694536649648686380122198677895751002327229059364018755164517060321515091173358005987498359799467138817648881479418623694683454881683746841149715181334498096967702613110590140231345676956141227850879905018558219984441819798054463206764413100251255775535830770535620946159535406497134759043192647996190512978586496199656070707105117773853504277795024754647024165589129442822627147868917463795166386552921913398878270019905147510849518894114102536073369047160130990411626048426437835295683097278297774735181045158616674564080237813146623269215019613231938626758927531490945029356207933289363847181438902539297057969524961348607844569521442237914899100699610921669921572167164875488132527187949318543809703388178931170799769792886086681284964861608656928109305369539955846964197786677053847603962194721523867993048528558551380823699291873352033111096244814245789620930756114228971363838828108534030152031715929722499546436547773404017947035596936338462103946797525667033935433489292620531649199724400832489751788129365426568881328357966337292439204382537174357675404105580244018783685041224798457022189315692175787257287203633134300759209060570319508886475377719911176071302732819878165468592717406388218727585026352127436844762994722826390779737322113768842482160812973100323673863050234437722898796145596181862320550301285861980052194863780743808106946940079349630782676930197134206259739125377941060751175427888774493677478593805682322173891730311959284895178856039354015035864931073602059531001572891528828982167810245343327388887928886208615327002834690068636094325052251429781641267821367266715283643659749152264457938319185148303604827363623405060374573505789923003843438436174489383805098509083722050766328250349793203837202162624690093533478114438810603140565070517669964629947543608404988178019652088162307525611931821066493746994641048066011859814337589829896549720562117090677291541318153057715167624128318297771376531788973088699647168159229805877415594828532539839967464064556647594705830374653113373530876658380240145380423210673778776803592627231257495817394581607796277282644312510714532297108722017217547317744900647318022108570947064304280100418971450552007356891519523293614416944016354756866350050833501416942505071203810116719053430543531027953437436446745566839242129860410443198862219469972163224971258348314341755015213118628882713134766297624091644805801186976152536913514712919240503721680740586016832099946807466311777189050656676962849581383790904722087478646766320517056183581970236248227413322748304134245717987665377396011236706627320817654565682680006957454759981618023476448544673508068369492066566895437050571584345511070959483898938738225050292533674383091612495407126805381796487365892131916426837522671623266627483065655765705534239355214893395905702329340402794052884259146049064629582075576563307670749189662176976725361937046200576007893814439695301892528761187544161389682003509216791271836545495416676148151145195082668323677621182991451835324281863619641773620601014510950996746726615703771971266687151564427772359427340566909351858654807999781808513034680104078196607462166928018863385629928965649243954503391493597963417955268639606791452833692467872935741940362479842688642227725662504694679557678170929873774151037857807219938356152056997839625453727441947651198316190826615266016347740875615970031428012228328190610356706715662722241878767131224669837573607121539572299329404101274463156060298348931678277361174057097484704587036227686110677413094941011961262438027467952964727129462752693949019764164538344775554466171428121848999818969114034332797672927989107710137279281184295118233855942385256333164153378143279674287318136458207166174996112638689535976047617221520910027427485161965702038805161865494457444594178063766957037428053543239915792369877811053417485684498667123216132006378630814477106813088898563644909178779463295955587688067277368683836470612208483299572260344016516194247232298740800342116589984844356688576984553507410293250093945014209879983314562948451929862241009275783684229669718641013736581856815277185073259140534024850924787544871716174654424640728091372513505922826813145390369149590652886241000625495880523771672395227312971578042522330551788256261683080675549820375567692574152956993944504349004617185470945673049153218968830613586193253490318451871770642617802890083608004460414305421033261048294750210470303202846332054952531617433058538758154347087854561609738141615145103748777579733574989673510104836750248325511777237502526995647687215364262385606217553691332159421351598905950537513518351520709657614578131639854432532002236696200855408766520105076378983345708235918180749273124590433024519869147132931932462703067876214268579940066030521414045386366551780718510535469417760242493782392451178913322503092692423649855756521279456558275339921490892868856862895022564047205838132429286600764536839036698193759634186899291274131934296059833048690594627623595320676097721540716472990950611858372856271872423573251506230042608074167903809812264198034505185435990821356377966484742250577592243727298923187891299404854048446822719928239317254073429532989089675503790372464487057264894107613242300912487070053676379388189496900004239731820229886894053019610823763957809819187948639826973433528683168917360632750040517847686479093538683816924213175672979768822065627696943474914020483056384006872835738311110986586149510661361915342172527409078742250880056867149831149121019729847242037335904440063130981999650700416787683293610119590221942974317455716336227454789239793488032299063316588917505912406020220045264868457718282165158892171630470709599503997282778168097827497383884195820921583645621293941200045604062174334998171535030513366277293714389988219756129580868518167923841173364269774889246694435264051484911461988227011238661037602452710188911900438270362280391121270021679247152879324195035694278071477495720447513017171148877312193736366348711630105507365864598069586257026976295714123943691621672377694552248018987680338612382795605985191106112971398796002636340393693119651973344711646854574482999700397952536878348512983782198330513744803168936076427075943787200489575435147989033386529956551570669047103070223076797892329848058499725632813524581372640746415923016932853954152472487866287318545051065376430120748079948860283261855738836955246188128622509828635867225708782966017423170535046509131388753895013061151387840089512861842615441729962315731301087767989000918136617870582141517330935619268642915983553727587587676791953536960714236687847602589538927962585440961131240218794236944630211930970546118745080346860636620310193382167597465544174488399379683716417891139157575146359165023126594124268610800205258776019000550873739401445303129974560221438061891795442780328126230093178952504570380957199592993338719686487798275474853570100033092481743129836527369756194343789131822069107283156271772679863538216891518713732520976834628418347371261368933454629405371869789752684339805368137450825001203521193642598238954329102258317328098581116978343883611320940814793654745807336162557057195523274610323601685712314930799144191673243832283659669368716126815118360353441303009936083544193524336572930768154506567477565558211143508568396203781879592033787429012753106951129653074630840496376302289668286168325299592504054003803917262600195834001336180158836765599057537979745423711070158871650976475924365707758401328959478791343481250979029363644046972556422294698558561670817595994409985323205913035009923360820734795546082012200697671744573982535291905800552837118327702125018691644774560916230166739307705017656065679867259837178918123254219579594535869171376148397610005870749992910355727569593729567789260479930835305112462727870603529547312621720559953074675620549217314861961905983960910846471569192459257648138212674016814845327496495507412976753381357634960529826817906824433858135485518651632270319927880227571858035210375443324098235463619647723862420557582355632137583370066602155641218235815280874570372436217877316899649287051943247206509113311767578124e-4966 -3.237587559719012555462219479113823276249784669017340504844942194598519770062059685508835745638324970127939070738424059838293609943191271023342555035986308991521396355375667467208367312819235870119724263252776995195727778126085574034035411017344128491238136414394551514178668780674015531193282296319913113495953953933831631032855605791532328598034154166422617226534880263244723830482289656875701701315902175019974435037627824356684033058939701577883356651733717468531204705842607568803666569711421917525834491783583598401321476176752039857173551930268891446850107760584333855521475305010940756813993214730850216669600967698749412592167692757446422169965426483919224341062751152057061076522973232731542382055087239368522167656194830741819605276971705738272393130698937532095725613383807312946395184980707534803490003540251394324459987958400939111001126190861523615485938285497714410609640798273816511769391568591823198476415765275534341709798367687043373145262933998108452661682659942586304978413812755518166239176614473815940025342279575304159493260770068030636885746695206392378276051948759263882079389379666940357441139816661913198656187703463519723262653223919257185751827493927586153153792077729913353547954808876263400200663495414360816863385220457719546338953323399286762099558324132103460225580066817535680886906060858264089074120360391613368274811868067637495154569071591624185979937989402513750464346904036668477876379544221432800037599944499161940321774835027752710681217554286366043661491013593886229615614494736186475932160549630939390542165126494166960681499481651861215529870984381726203476917507560266886692644952355421814201350137351435237036912624414444992497142303802423605897110605364956579914507108584002230524766331348271456591814078599780820974961968314684496428310691542272663818486132771177670874927831510002443658417608078383611526899905533629456904234997116303929427262032216072887961072267850618234492852606488522739744757845004694461812790342894353802938671928834585447328398711684245164703625580196678024410303542544534512706792134908369873605619756775207191558754413381571756431003248529020572648048946458999967788526617126349345966896362376841092268841417781414969315002419192181972121568811432459128737128140063645558482525300089060238860392371092102688097987915838860882370022268312322882235690785726190915062699382576041643741555139697348927957856990969985342299599797431503615312038393069808777315725367497595040966093808407117316369389112216628231869173217637452855462790553030636920487796465880633399632793882734473382168542596184679158149228725004404714293460752371865436947855237307240001863573081174929166645758276081272685156100195420794154740486637315823136798695124738873328565945598241199335059398955049459449844741098478330319112865980346771381982151154499846478545530650091824164892591396650703633600023191521502618379988693800703884555191647864959327260468892793195316578510173816406054364319294906641284764788384683586662382042642852654156477478700779123584369965723284711409361741235548687181052639639279285373139084165798451899763979500837428077782309910703522399860010310321116623028924118238023770381424894162717815296210097245221769714495449744327945091943394325259297771090128969600269822520904193880119094781214175887316220311309028456568749910010962366586834018403242866721783519806933018588077977626913774236680220258524711348037750591646286531625306510583751929280541119187219596706615736304036444366663256426643903386694536649648686380122198677895751002327229059364018755164517060321515091173358005987498359799467138817648881479418623694683454881683746841149715181334498096967702613110590140231345676956141227850879905018558219984441819798054463206764413100251255775535830770535620946159535406497134759043192647996190512978586496199656070707105117773853504277795024754647024165589129442822627147868917463795166386552921913398878270019905147510849518894114102536073369047160130990411626048426437835295683097278297774735181045158616674564080237813146623269215019613231938626758927531490945029356207933289363847181438902539297057969524961348607844569521442237914899100699610921669921572167164875488132527187949318543809703388178931170799769792886086681284964861608656928109305369539955846964197786677053847603962194721523867993048528558551380823699291873352033111096244814245789620930756114228971363838828108534030152031715929722499546436547773404017947035596936338462103946797525667033935433489292620531649199724400832489751788129365426568881328357966337292439204382537174357675404105580244018783685041224798457022189315692175787257287203633134300759209060570319508886475377719911176071302732819878165468592717406388218727585026352127436844762994722826390779737322113768842482160812973100323673863050234437722898796145596181862320550301285861980052194863780743808106946940079349630782676930197134206259739125377941060751175427888774493677478593805682322173891730311959284895178856039354015035864931073602059531001572891528828982167810245343327388887928886208615327002834690068636094325052251429781641267821367266715283643659749152264457938319185148303604827363623405060374573505789923003843438436174489383805098509083722050766328250349793203837202162624690093533478114438810603140565070517669964629947543608404988178019652088162307525611931821066493746994641048066011859814337589829896549720562117090677291541318153057715167624128318297771376531788973088699647168159229805877415594828532539839967464064556647594705830374653113373530876658380240145380423210673778776803592627231257495817394581607796277282644312510714532297108722017217547317744900647318022108570947064304280100418971450552007356891519523293614416944016354756866350050833501416942505071203810116719053430543531027953437436446745566839242129860410443198862219469972163224971258348314341755015213118628882713134766297624091644805801186976152536913514712919240503721680740586016832099946807466311777189050656676962849581383790904722087478646766320517056183581970236248227413322748304134245717987665377396011236706627320817654565682680006957454759981618023476448544673508068369492066566895437050571584345511070959483898938738225050292533674383091612495407126805381796487365892131916426837522671623266627483065655765705534239355214893395905702329340402794052884259146049064629582075576563307670749189662176976725361937046200576007893814439695301892528761187544161389682003509216791271836545495416676148151145195082668323677621182991451835324281863619641773620601014510950996746726615703771971266687151564427772359427340566909351858654807999781808513034680104078196607462166928018863385629928965649243954503391493597963417955268639606791452833692467872935741940362479842688642227725662504694679557678170929873774151037857807219938356152056997839625453727441947651198316190826615266016347740875615970031428012228328190610356706715662722241878767131224669837573607121539572299329404101274463156060298348931678277361174057097484704587036227686110677413094941011961262438027467952964727129462752693949019764164538344775554466171428121848999818969114034332797672927989107710137279281184295118233855942385256333164153378143279674287318136458207166174996112638689535976047617221520910027427485161965702038805161865494457444594178063766957037428053543239915792369877811053417485684498667123216132006378630814477106813088898563644909178779463295955587688067277368683836470612208483299572260344016516194247232298740800342116589984844356688576984553507410293250093945014209879983314562948451929862241009275783684229669718641013736581856815277185073259140534024850924787544871716174654424640728091372513505922826813145390369149590652886241000625495880523771672395227312971578042522330551788256261683080675549820375567692574152956993944504349004617185470945673049153218968830613586193253490318451871770642617802890083608004460414305421033261048294750210470303202846332054952531617433058538758154347087854561609738141615145103748777579733574989673510104836750248325511777237502526995647687215364262385606217553691332159421351598905950537513518351520709657614578131639854432532002236696200855408766520105076378983345708235918180749273124590433024519869147132931932462703067876214268579940066030521414045386366551780718510535469417760242493782392451178913322503092692423649855756521279456558275339921490892868856862895022564047205838132429286600764536839036698193759634186899291274131934296059833048690594627623595320676097721540716472990950611858372856271872423573251506230042608074167903809812264198034505185435990821356377966484742250577592243727298923187891299404854048446822719928239317254073429532989089675503790372464487057264894107613242300912487070053676379388189496900004239731820229886894053019610823763957809819187948639826973433528683168917360632750040517847686479093538683816924213175672979768822065627696943474914020483056384006872835738311110986586149510661361915342172527409078742250880056867149831149121019729847242037335904440063130981999650700416787683293610119590221942974317455716336227454789239793488032299063316588917505912406020220045264868457718282165158892171630470709599503997282778168097827497383884195820921583645621293941200045604062174334998171535030513366277293714389988219756129580868518167923841173364269774889246694435264051484911461988227011238661037602452710188911900438270362280391121270021679247152879324195035694278071477495720447513017171148877312193736366348711630105507365864598069586257026976295714123943691621672377694552248018987680338612382795605985191106112971398796002636340393693119651973344711646854574482999700397952536878348512983782198330513744803168936076427075943787200489575435147989033386529956551570669047103070223076797892329848058499725632813524581372640746415923016932853954152472487866287318545051065376430120748079948860283261855738836955246188128622509828635867225708782966017423170535046509131388753895013061151387840089512861842615441729962315731301087767989000918136617870582141517330935619268642915983553727587587676791953536960714236687847602589538927962585440961131240218794236944630211930970546118745080346860636620310193382167597465544174488399379683716417891139157575146359165023126594124268610800205258776019000550873739401445303129974560221438061891795442780328126230093178952504570380957199592993338719686487798275474853570100033092481743129836527369756194343789131822069107283156271772679863538216891518713732520976834628418347371261368933454629405371869789752684339805368137450825001203521193642598238954329102258317328098581116978343883611320940814793654745807336162557057195523274610323601685712314930799144191673243832283659669368716126815118360353441303009936083544193524336572930768154506567477565558211143508568396203781879592033787429012753106951129653074630840496376302289668286168325299592504054003803917262600195834001336180158836765599057537979745423711070158871650976475924365707758401328959478791343481250979029363644046972556422294698558561670817595994409985323205913035009923360820734795546082012200697671744573982535291905800552837118327702125018691644774560916230166739307705017656065679867259837178918123254219579594535869171376148397610005870749992910355727569593729567789260479930835305112462727870603529547312621720559953074675620549217314861961905983960910846471569192459257648138212674016814845327496495507412976753381357634960529826817906824433858135485518651632270319927880227571858035210375443324098235463619647723862420557582355632137583370066602155641218235815280874570372436217877316899649287051943247206509113311767578125e-4966 -3.237587559719012555462219479113823276249784669017340504844942194598519770062059685508835745638324970127939070738424059838293609943191271023342555035986308991521396355375667467208367312819235870119724263252776995195727778126085574034035411017344128491238136414394551514178668780674015531193282296319913113495953953933831631032855605791532328598034154166422617226534880263244723830482289656875701701315902175019974435037627824356684033058939701577883356651733717468531204705842607568803666569711421917525834491783583598401321476176752039857173551930268891446850107760584333855521475305010940756813993214730850216669600967698749412592167692757446422169965426483919224341062751152057061076522973232731542382055087239368522167656194830741819605276971705738272393130698937532095725613383807312946395184980707534803490003540251394324459987958400939111001126190861523615485938285497714410609640798273816511769391568591823198476415765275534341709798367687043373145262933998108452661682659942586304978413812755518166239176614473815940025342279575304159493260770068030636885746695206392378276051948759263882079389379666940357441139816661913198656187703463519723262653223919257185751827493927586153153792077729913353547954808876263400200663495414360816863385220457719546338953323399286762099558324132103460225580066817535680886906060858264089074120360391613368274811868067637495154569071591624185979937989402513750464346904036668477876379544221432800037599944499161940321774835027752710681217554286366043661491013593886229615614494736186475932160549630939390542165126494166960681499481651861215529870984381726203476917507560266886692644952355421814201350137351435237036912624414444992497142303802423605897110605364956579914507108584002230524766331348271456591814078599780820974961968314684496428310691542272663818486132771177670874927831510002443658417608078383611526899905533629456904234997116303929427262032216072887961072267850618234492852606488522739744757845004694461812790342894353802938671928834585447328398711684245164703625580196678024410303542544534512706792134908369873605619756775207191558754413381571756431003248529020572648048946458999967788526617126349345966896362376841092268841417781414969315002419192181972121568811432459128737128140063645558482525300089060238860392371092102688097987915838860882370022268312322882235690785726190915062699382576041643741555139697348927957856990969985342299599797431503615312038393069808777315725367497595040966093808407117316369389112216628231869173217637452855462790553030636920487796465880633399632793882734473382168542596184679158149228725004404714293460752371865436947855237307240001863573081174929166645758276081272685156100195420794154740486637315823136798695124738873328565945598241199335059398955049459449844741098478330319112865980346771381982151154499846478545530650091824164892591396650703633600023191521502618379988693800703884555191647864959327260468892793195316578510173816406054364319294906641284764788384683586662382042642852654156477478700779123584369965723284711409361741235548687181052639639279285373139084165798451899763979500837428077782309910703522399860010310321116623028924118238023770381424894162717815296210097245221769714495449744327945091943394325259297771090128969600269822520904193880119094781214175887316220311309028456568749910010962366586834018403242866721783519806933018588077977626913774236680220258524711348037750591646286531625306510583751929280541119187219596706615736304036444366663256426643903386694536649648686380122198677895751002327229059364018755164517060321515091173358005987498359799467138817648881479418623694683454881683746841149715181334498096967702613110590140231345676956141227850879905018558219984441819798054463206764413100251255775535830770535620946159535406497134759043192647996190512978586496199656070707105117773853504277795024754647024165589129442822627147868917463795166386552921913398878270019905147510849518894114102536073369047160130990411626048426437835295683097278297774735181045158616674564080237813146623269215019613231938626758927531490945029356207933289363847181438902539297057969524961348607844569521442237914899100699610921669921572167164875488132527187949318543809703388178931170799769792886086681284964861608656928109305369539955846964197786677053847603962194721523867993048528558551380823699291873352033111096244814245789620930756114228971363838828108534030152031715929722499546436547773404017947035596936338462103946797525667033935433489292620531649199724400832489751788129365426568881328357966337292439204382537174357675404105580244018783685041224798457022189315692175787257287203633134300759209060570319508886475377719911176071302732819878165468592717406388218727585026352127436844762994722826390779737322113768842482160812973100323673863050234437722898796145596181862320550301285861980052194863780743808106946940079349630782676930197134206259739125377941060751175427888774493677478593805682322173891730311959284895178856039354015035864931073602059531001572891528828982167810245343327388887928886208615327002834690068636094325052251429781641267821367266715283643659749152264457938319185148303604827363623405060374573505789923003843438436174489383805098509083722050766328250349793203837202162624690093533478114438810603140565070517669964629947543608404988178019652088162307525611931821066493746994641048066011859814337589829896549720562117090677291541318153057715167624128318297771376531788973088699647168159229805877415594828532539839967464064556647594705830374653113373530876658380240145380423210673778776803592627231257495817394581607796277282644312510714532297108722017217547317744900647318022108570947064304280100418971450552007356891519523293614416944016354756866350050833501416942505071203810116719053430543531027953437436446745566839242129860410443198862219469972163224971258348314341755015213118628882713134766297624091644805801186976152536913514712919240503721680740586016832099946807466311777189050656676962849581383790904722087478646766320517056183581970236248227413322748304134245717987665377396011236706627320817654565682680006957454759981618023476448544673508068369492066566895437050571584345511070959483898938738225050292533674383091612495407126805381796487365892131916426837522671623266627483065655765705534239355214893395905702329340402794052884259146049064629582075576563307670749189662176976725361937046200576007893814439695301892528761187544161389682003509216791271836545495416676148151145195082668323677621182991451835324281863619641773620601014510950996746726615703771971266687151564427772359427340566909351858654807999781808513034680104078196607462166928018863385629928965649243954503391493597963417955268639606791452833692467872935741940362479842688642227725662504694679557678170929873774151037857807219938356152056997839625453727441947651198316190826615266016347740875615970031428012228328190610356706715662722241878767131224669837573607121539572299329404101274463156060298348931678277361174057097484704587036227686110677413094941011961262438027467952964727129462752693949019764164538344775554466171428121848999818969114034332797672927989107710137279281184295118233855942385256333164153378143279674287318136458207166174996112638689535976047617221520910027427485161965702038805161865494457444594178063766957037428053543239915792369877811053417485684498667123216132006378630814477106813088898563644909178779463295955587688067277368683836470612208483299572260344016516194247232298740800342116589984844356688576984553507410293250093945014209879983314562948451929862241009275783684229669718641013736581856815277185073259140534024850924787544871716174654424640728091372513505922826813145390369149590652886241000625495880523771672395227312971578042522330551788256261683080675549820375567692574152956993944504349004617185470945673049153218968830613586193253490318451871770642617802890083608004460414305421033261048294750210470303202846332054952531617433058538758154347087854561609738141615145103748777579733574989673510104836750248325511777237502526995647687215364262385606217553691332159421351598905950537513518351520709657614578131639854432532002236696200855408766520105076378983345708235918180749273124590433024519869147132931932462703067876214268579940066030521414045386366551780718510535469417760242493782392451178913322503092692423649855756521279456558275339921490892868856862895022564047205838132429286600764536839036698193759634186899291274131934296059833048690594627623595320676097721540716472990950611858372856271872423573251506230042608074167903809812264198034505185435990821356377966484742250577592243727298923187891299404854048446822719928239317254073429532989089675503790372464487057264894107613242300912487070053676379388189496900004239731820229886894053019610823763957809819187948639826973433528683168917360632750040517847686479093538683816924213175672979768822065627696943474914020483056384006872835738311110986586149510661361915342172527409078742250880056867149831149121019729847242037335904440063130981999650700416787683293610119590221942974317455716336227454789239793488032299063316588917505912406020220045264868457718282165158892171630470709599503997282778168097827497383884195820921583645621293941200045604062174334998171535030513366277293714389988219756129580868518167923841173364269774889246694435264051484911461988227011238661037602452710188911900438270362280391121270021679247152879324195035694278071477495720447513017171148877312193736366348711630105507365864598069586257026976295714123943691621672377694552248018987680338612382795605985191106112971398796002636340393693119651973344711646854574482999700397952536878348512983782198330513744803168936076427075943787200489575435147989033386529956551570669047103070223076797892329848058499725632813524581372640746415923016932853954152472487866287318545051065376430120748079948860283261855738836955246188128622509828635867225708782966017423170535046509131388753895013061151387840089512861842615441729962315731301087767989000918136617870582141517330935619268642915983553727587587676791953536960714236687847602589538927962585440961131240218794236944630211930970546118745080346860636620310193382167597465544174488399379683716417891139157575146359165023126594124268610800205258776019000550873739401445303129974560221438061891795442780328126230093178952504570380957199592993338719686487798275474853570100033092481743129836527369756194343789131822069107283156271772679863538216891518713732520976834628418347371261368933454629405371869789752684339805368137450825001203521193642598238954329102258317328098581116978343883611320940814793654745807336162557057195523274610323601685712314930799144191673243832283659669368716126815118360353441303009936083544193524336572930768154506567477565558211143508568396203781879592033787429012753106951129653074630840496376302289668286168325299592504054003803917262600195834001336180158836765599057537979745423711070158871650976475924365707758401328959478791343481250979029363644046972556422294698558561670817595994409985323205913035009923360820734795546082012200697671744573982535291905800552837118327702125018691644774560916230166739307705017656065679867259837178918123254219579594535869171376148397610005870749992910355727569593729567789260479930835305112462727870603529547312621720559953074675620549217314861961905983960910846471569192459257648138212674016814845327496495507412976753381357634960529826817906824433858135485518651632270319927880227571858035210375443324098235463619647723862420557582355632137583370066602155641218235815280874570372436217877316899649287051943247206509113311767578126e-4966 +340282366920938463463374607431768211455 +179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137215 +1189731495357231765085759326628007130763444687096510237472674821233261358180483686904488595472612039915115437484839309258897667381308687426274524698341565006080871634366004897522143251619531446845952345709482135847036647464830984784714280967845614138476044338404886122905286855313236158695999885790106357018120815363320780964323712757164290613406875202417365323950267880089067517372270610835647545755780793431622213451903817859630690311343850657539360649645193283178291767658965405285113556134369793281725888015908414675289832538063419234888599898980623114025121674472051872439321323198402942705341366951274739014593816898288994445173400364617928377138074411345791848573595077170437644191743889644885377684738322240608239079061399475675334739784016491742621485229014847672335977897158397334226349734811441653077758250988926030894789604676153104257260141806823027588003441951455327701598071281589597169413965608439504983171255062282026626200048042149808200002060993433681237623857880627479727072877482838438705048034164633337013385405998040701908662387301605018188262573723766279240798931717708807901740265407930976419648877869604017517691938687988088008944251258826969688364194133945780157844364946052713655454906327187428531895100278695119323496808703630436193927592692344820812834297364478686862064169042458555136532055050508189891866846863799917647547291371573500701015197559097453040033031520683518216494195636696077748110598284901343611469214274121810495077979275556645164983850062051066517084647369464036640569339464837172183352956873912042640003611618789278195710052094562761306703551840330110645101995435167626688669627763820604342480357906415354212732946756073006907088870496125050068156659252761297664065498347492661798824062312210409274584565587264846417650160123175874034726261957289081466197651553830744424709698634753627770356227126145052549125229448040149114795681359875968512808575244271871455454084894986155020794806980939215658055319165641681105966454159951476908583129721503298816585142073061480888021769818338417129396878371459575846052583142928447249703698548125295775920936450022651427249949580708203966082847550921891152133321048011973883636577825533325988852156325439335021315312134081390451021255363707903495916963125924201167877190108935255914539488216897117943269373608639074472792751116715127106396425081353553137213552890539802602978645319795100976432939091924660228878912900654210118287298298707382159717184569540515403029173307292454391789568674219640761451173600617752186991913366837033887201582071625868247133104513315097274713442728340606642890406496636104443217752811227470029162858093727701049646499540220983981932786613204254226464243689610107429923197638681545837561773535568984536053627234424277105760924864023781629665526314910906960488073475217005121136311870439925762508666032566213750416695719919674223210606724721373471234021613540712188239909701971943944347480314217903886317767779921539892177334344368907550318800833546852344370327089284147501640589448482001254237386680074457341910933774891959681016516069106149905572425810895586938833067490204900368624166301968553005687040285095450484840073528643826570403767157286512380255109954518857013476588189300004138849715883139866071547574816476727635116435462804401112711392529180570794193422686818353212799068972247697191474268157912195973794192807298886952361100880264258801320928040011928153970801130741339550003299015924978259936974358726286143980520112454369271114083747919007803406596321353417004068869443405472140675963640997405009225803505672726465095506267339268892424364561897661906898424186770491035344080399248327097911712881140170384182058601614758284200750183500329358499691864066590539660709069537381601887679046657759654588001937117771344698326428792622894338016112445533539447087462049763409147542099248815521395929388007711172017894897793706604273480985161028815458787911160979113422433557549170905442026397275695283207305331845419990749347810524006194197200591652147867193696254337864981603833146354201700628817947177518115217674352016511172347727727075220056177748218928597158346744541337107358427757919660562583883823262178961691787226118865632764934288772405859754877759869235530653929937901193611669007472354746360764601872442031379944139824366828698790212922996174192728625891720057612509349100482545964152046477925114446500732164109099345259799455690095576788686397487061948854749024863607921857834205793797188834779656273479112388585706424836379072355410286787018527401653934219888361061949671961055068686961468019035629749424086587195041004404915266476272761070511568387063401264136517237211409916458796347624949215904533937210937520465798300175408017538862312719042361037129338896586028150046596078872444365564480545689033575955702988396719744528212984142578483954005084264327730840985420021409069485412320805268520094146798876110414583170390473982488899228091818213934288295679717369943152460447027290669964066815 +-340282366920938463463374607431768211455 +-179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137215 +-1189731495357231765085759326628007130763444687096510237472674821233261358180483686904488595472612039915115437484839309258897667381308687426274524698341565006080871634366004897522143251619531446845952345709482135847036647464830984784714280967845614138476044338404886122905286855313236158695999885790106357018120815363320780964323712757164290613406875202417365323950267880089067517372270610835647545755780793431622213451903817859630690311343850657539360649645193283178291767658965405285113556134369793281725888015908414675289832538063419234888599898980623114025121674472051872439321323198402942705341366951274739014593816898288994445173400364617928377138074411345791848573595077170437644191743889644885377684738322240608239079061399475675334739784016491742621485229014847672335977897158397334226349734811441653077758250988926030894789604676153104257260141806823027588003441951455327701598071281589597169413965608439504983171255062282026626200048042149808200002060993433681237623857880627479727072877482838438705048034164633337013385405998040701908662387301605018188262573723766279240798931717708807901740265407930976419648877869604017517691938687988088008944251258826969688364194133945780157844364946052713655454906327187428531895100278695119323496808703630436193927592692344820812834297364478686862064169042458555136532055050508189891866846863799917647547291371573500701015197559097453040033031520683518216494195636696077748110598284901343611469214274121810495077979275556645164983850062051066517084647369464036640569339464837172183352956873912042640003611618789278195710052094562761306703551840330110645101995435167626688669627763820604342480357906415354212732946756073006907088870496125050068156659252761297664065498347492661798824062312210409274584565587264846417650160123175874034726261957289081466197651553830744424709698634753627770356227126145052549125229448040149114795681359875968512808575244271871455454084894986155020794806980939215658055319165641681105966454159951476908583129721503298816585142073061480888021769818338417129396878371459575846052583142928447249703698548125295775920936450022651427249949580708203966082847550921891152133321048011973883636577825533325988852156325439335021315312134081390451021255363707903495916963125924201167877190108935255914539488216897117943269373608639074472792751116715127106396425081353553137213552890539802602978645319795100976432939091924660228878912900654210118287298298707382159717184569540515403029173307292454391789568674219640761451173600617752186991913366837033887201582071625868247133104513315097274713442728340606642890406496636104443217752811227470029162858093727701049646499540220983981932786613204254226464243689610107429923197638681545837561773535568984536053627234424277105760924864023781629665526314910906960488073475217005121136311870439925762508666032566213750416695719919674223210606724721373471234021613540712188239909701971943944347480314217903886317767779921539892177334344368907550318800833546852344370327089284147501640589448482001254237386680074457341910933774891959681016516069106149905572425810895586938833067490204900368624166301968553005687040285095450484840073528643826570403767157286512380255109954518857013476588189300004138849715883139866071547574816476727635116435462804401112711392529180570794193422686818353212799068972247697191474268157912195973794192807298886952361100880264258801320928040011928153970801130741339550003299015924978259936974358726286143980520112454369271114083747919007803406596321353417004068869443405472140675963640997405009225803505672726465095506267339268892424364561897661906898424186770491035344080399248327097911712881140170384182058601614758284200750183500329358499691864066590539660709069537381601887679046657759654588001937117771344698326428792622894338016112445533539447087462049763409147542099248815521395929388007711172017894897793706604273480985161028815458787911160979113422433557549170905442026397275695283207305331845419990749347810524006194197200591652147867193696254337864981603833146354201700628817947177518115217674352016511172347727727075220056177748218928597158346744541337107358427757919660562583883823262178961691787226118865632764934288772405859754877759869235530653929937901193611669007472354746360764601872442031379944139824366828698790212922996174192728625891720057612509349100482545964152046477925114446500732164109099345259799455690095576788686397487061948854749024863607921857834205793797188834779656273479112388585706424836379072355410286787018527401653934219888361061949671961055068686961468019035629749424086587195041004404915266476272761070511568387063401264136517237211409916458796347624949215904533937210937520465798300175408017538862312719042361037129338896586028150046596078872444365564480545689033575955702988396719744528212984142578483954005084264327730840985420021409069485412320805268520094146798876110414583170390473982488899228091818213934288295679717369943152460447027290669964066815 ++0x.80000000000000000000000000000001p1025 diff --git a/stdlib/tst-strtod-round-skeleton.c b/stdlib/tst-strtod-round-skeleton.c index 1b49662..95bf1ac 100644 --- a/stdlib/tst-strtod-round-skeleton.c +++ b/stdlib/tst-strtod-round-skeleton.c @@ -121,7 +121,8 @@ #define ENTRY(...) \ GEN_TEST_STRTOD_FOREACH (_ENTRY, __VA_ARGS__) -/* Selector for boolean exact tag of expected results. */ +/* Selector for boolean exact tag of expected results and that for + overflow. */ #define _XNTRY(FSUF, FTYPE, FTOSTR, LSUF, CSUF, ...) \ CHOOSE_ ## FSUF (__VA_ARGS__), #define XNTRY(...) \ @@ -136,22 +137,32 @@ /* This macro is used in conjunction with the output from the gen-tst-strtod-round utility to select the appropriately rounded long double value for a given format. */ -#define TEST(s, \ - fx, fd, fn, fz, fu, \ - dx, dd, dn, dz, du, \ - ld64ix, ld64id, ld64in, ld64iz, ld64iu, \ - ld64mx, ld64md, ld64mn, ld64mz, ld64mu, \ - ld106x, ld106d, ld106n, ld106z, ld106u, \ - ld113x, ld113d, ld113n, ld113z, ld113u) \ - { \ - L_ (s), \ - { XNTRY (fx, dx, ld64ix, ld64mx, ld106x, ld113x) }, \ - { \ - { ENTRY (fn, dn, ld64in, ld64mn, ld106n, ld113n) }, \ - { ENTRY (fd, dd, ld64id, ld64md, ld106d, ld113d) }, \ - { ENTRY (fz, dz, ld64iz, ld64mz, ld106z, ld113z) }, \ - { ENTRY (fu, du, ld64iu, ld64mu, ld106u, ld113u) } \ - } \ +#define TEST(s, \ + fx, fd, fdo, fn, fno, fz, fzo, fu, fuo, \ + dx, dd, ddo, dn, dno, dz, dzo, du, duo, \ + ld64ix, ld64id, ld64ido, ld64in, ld64ino, \ + ld64iz, ld64izo, ld64iu, ld64iuo, \ + ld64mx, ld64md, ld64mdo, ld64mn, ld64mno, \ + ld64mz, ld64mzo, ld64mu, ld64muo, \ + ld106x, ld106d, ld106do, ld106n, ld106no, \ + ld106z, ld106zo, ld106u, ld106uo, \ + ld113x, ld113d, ld113do, ld113n, ld113no, \ + ld113z, ld113zo, ld113u, ld113uo) \ + { \ + L_ (s), \ + { XNTRY (fx, dx, ld64ix, ld64mx, ld106x, ld113x) }, \ + { \ + { ENTRY (fn, dn, ld64in, ld64mn, ld106n, ld113n) }, \ + { ENTRY (fd, dd, ld64id, ld64md, ld106d, ld113d) }, \ + { ENTRY (fz, dz, ld64iz, ld64mz, ld106z, ld113z) }, \ + { ENTRY (fu, du, ld64iu, ld64mu, ld106u, ld113u) } \ + }, \ + { \ + { XNTRY (fno, dno, ld64ino, ld64mno, ld106no, ld113no) }, \ + { XNTRY (fdo, ddo, ld64ido, ld64mdo, ld106do, ld113do) }, \ + { XNTRY (fzo, dzo, ld64izo, ld64mzo, ld106zo, ld113zo) }, \ + { XNTRY (fuo, duo, ld64iuo, ld64muo, ld106uo, ld113uo) } \ + } \ } struct test_exactness @@ -164,10 +175,16 @@ struct test_results STRUCT_FOREACH_FLOAT_FTYPE }; +struct test_overflow + { + STRUCT_FOREACH_FLOAT_BOOL + }; + struct test { const CHAR *s; struct test_exactness exact; struct test_results r[4]; + struct test_overflow o[4]; }; /* Include the generated test data. */ @@ -181,9 +198,13 @@ struct test { # define FE_INEXACT 0 #endif +#ifndef FE_OVERFLOW +# define FE_OVERFLOW 0 +#endif + #define GEN_ONE_TEST(FSUF, FTYPE, FTOSTR, LSUF, CSUF) \ { \ - feclearexcept (FE_INEXACT); \ + feclearexcept (FE_ALL_EXCEPT); \ FTYPE f = STRTO (FSUF) (s, NULL); \ if (f != expected->FSUF \ || (copysign ## CSUF) (1.0 ## LSUF, f) \ @@ -200,25 +221,47 @@ struct test { else \ printf ("ignoring this inexact result\n"); \ } \ - else if (FE_INEXACT != 0) \ + else \ { \ - bool inexact_raised = fetestexcept (FE_INEXACT) != 0; \ - if (inexact_raised != !exact->FSUF) \ + if (FE_INEXACT != 0) \ + { \ + bool inexact_raised = fetestexcept (FE_INEXACT) != 0; \ + if (inexact_raised != !exact->FSUF) \ + { \ + printf (FNPFXS "to" #FSUF \ + " (" STRM ") inexact %d " \ + "not %d\n", s, inexact_raised, \ + !exact->FSUF); \ + if (EXCEPTION_TESTS (FTYPE)) \ + result = 1; \ + else \ + printf ("ignoring this exception error\n"); \ + } \ + } \ + if (FE_OVERFLOW != 0) \ { \ - printf (FNPFXS "to" #FSUF " (" STRM ") inexact %d " \ - "not %d\n", s, inexact_raised, !exact->FSUF); \ - if (EXCEPTION_TESTS (FTYPE)) \ - result = 1; \ - else \ - printf ("ignoring this exception error\n"); \ + bool overflow_raised \ + = fetestexcept (FE_OVERFLOW) != 0; \ + if (overflow_raised != overflow->FSUF) \ + { \ + printf (FNPFXS "to" #FSUF \ + " (" STRM ") overflow %d " \ + "not %d\n", s, overflow_raised, \ + overflow->FSUF); \ + if (EXCEPTION_TESTS (FTYPE)) \ + result = 1; \ + else \ + printf ("ignoring this exception error\n"); \ + } \ } \ } \ } static int test_in_one_mode (const CHAR *s, const struct test_results *expected, - const struct test_exactness *exact, const char *mode_name, - int rnd_mode) + const struct test_exactness *exact, + const struct test_overflow *overflow, + const char *mode_name, int rnd_mode) { int result = 0; GEN_TEST_STRTOD_FOREACH (GEN_ONE_TEST) @@ -252,14 +295,15 @@ do_test (void) for (size_t i = 0; i < sizeof (tests) / sizeof (tests[0]); i++) { result |= test_in_one_mode (tests[i].s, &tests[i].r[modes[0].rnd_i], - &tests[i].exact, modes[0].mode_name, - modes[0].rnd_mode); + &tests[i].exact, &tests[i].o[modes[0].rnd_i], + modes[0].mode_name, modes[0].rnd_mode); for (const struct fetestmodes *m = &modes[1]; m->mode_name != NULL; m++) { if (!fesetround (m->rnd_mode)) { result |= test_in_one_mode (tests[i].s, &tests[i].r[m->rnd_i], - &tests[i].exact, m->mode_name, + &tests[i].exact, + &tests[i].o[m->rnd_i], m->mode_name, m->rnd_mode); fesetround (save_round_mode); }