This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/31836] [4.3 Regression] FAIL: 27_io/basic_istream/extractors_arithmetic/char/12.cc execution test



------- Comment #33 from pcarlini at suse dot de  2007-05-14 16:54 -------
(In reply to comment #32)
> /* Define to 1 if you have the `finitef' function. */
> /* #undef _GLIBCXX_HAVE_FINITEF */
> /* Define to 1 if you have the `_finitef' function. */
> /* #undef _GLIBCXX_HAVE__FINITEF */
> /* Define to 1 if you have the `finite' function. */
> /* #undef _GLIBCXX_HAVE_FINITE */
> /* Define to 1 if you have the `_finite' function. */
> /* #undef _GLIBCXX_HAVE__FINITE */
> /* Define to 1 if you have the `isinf' function. */
> /* #undef _GLIBCXX_HAVE_ISINF */
> /* Define to 1 if you have the `_isinf' function. */
> /* #undef _GLIBCXX_HAVE__ISINF */

Ok, all undefined, it's possible.

> Thus, the test that should be performed in
> _ZSt14__convert_to_vIfEvPKcRT_RSt12_Ios_IostateRKPi should be:
> 
>       if (fabs(__d) > numeric_limits<float>::max())
>         errno = ERANGE;

Only *if* _GLIBCXX_HAVE_STRTOF is not defined, however.

> Disassembly of that method shows that the test has been
> optimized away.
> This is not actually surprising, because _GLIBCXX_HAVE_STRTOF
> has been set, and hence strtof has been used, and
> __d remained uninitalized.

Ok, therefore _GLIBCXX_HAVE_STRTOF is set and no further test is needed before
the final one. In this case __d isn't optimized out, simply the pre-processor
selects:

      float __f = strtof(__s, &__sanity);

instead of

      double __d = strtod(__s, &__sanity);
      float __f = static_cast<float>(__d);

Now, the strange thing is that, before these two last patches (in 4_2-branch in
other terms), errno doesn't turn out to be == ERANGE for your target: strtof
should have set it...


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31836


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]