diff mbox

libstdc++/65142 Check read() result in std::random_device.

Message ID alpine.LSU.2.20.1509172025460.3004@tuna.site
State New
Headers show

Commit Message

Gerald Pfeifer Sept. 17, 2015, 8:21 p.m. UTC
On Thu, 17 Sep 2015, Jonathan Wakely wrote:
>> Any comments on this version?
> Committed to trunk.

Unfortunately this broke bootstrap on FreeBSD 10.1.

/scratch/tmp/gerald/gcc-HEAD/libstdc++-v3/src/c++11/random.cc: In member function 'std::random_device::result_type std::random_device::_M_getval()':
/scratch/tmp/gerald/gcc-HEAD/libstdc++-v3/src/c++11/random.cc:144:22: error: 'errno' was not declared in this scope
  else if (e != -1 || errno != EINTR)
                      ^
/scratch/tmp/gerald/gcc-HEAD/libstdc++-v3/src/c++11/random.cc:144:31: error: 'EINTR' was not declared in this scope
  else if (e != -1 || errno != EINTR)
                               ^
Makefile:545: recipe for target 'random.lo' failed

I probably won't be able to dig in deeper today, but figured this
might already send you on the right path?

Actually...

...how about he patch below?  Bootstraps on i386-unknown-freebsd10.1,
no regressions.

Gerald


2015-09-17  Gerald Pfeifer  <gerald@pfeifer.com>

	* src/c++11/random.cc: Include <cerrno>.

Comments

Jonathan Wakely Sept. 17, 2015, 9:28 p.m. UTC | #1
On 17/09/15 22:21 +0200, Gerald Pfeifer wrote:
>On Thu, 17 Sep 2015, Jonathan Wakely wrote:
>>> Any comments on this version?
>> Committed to trunk.
>
>Unfortunately this broke bootstrap on FreeBSD 10.1.
>
>/scratch/tmp/gerald/gcc-HEAD/libstdc++-v3/src/c++11/random.cc: In member function 'std::random_device::result_type std::random_device::_M_getval()':
>/scratch/tmp/gerald/gcc-HEAD/libstdc++-v3/src/c++11/random.cc:144:22: error: 'errno' was not declared in this scope
>  else if (e != -1 || errno != EINTR)
>                      ^
>/scratch/tmp/gerald/gcc-HEAD/libstdc++-v3/src/c++11/random.cc:144:31: error: 'EINTR' was not declared in this scope
>  else if (e != -1 || errno != EINTR)
>                               ^
>Makefile:545: recipe for target 'random.lo' failed
>
>I probably won't be able to dig in deeper today, but figured this
>might already send you on the right path?
>
>Actually...
>
>...how about he patch below?  Bootstraps on i386-unknown-freebsd10.1,
>no regressions.

Sorry about that, I've committed your patch.

>Gerald
>
>
>2015-09-17  Gerald Pfeifer  <gerald@pfeifer.com>
>
>	* src/c++11/random.cc: Include <cerrno>.
>
>Index: libstdc++-v3/src/c++11/random.cc
>===================================================================
>--- libstdc++-v3/src/c++11/random.cc	(revision 227883)
>+++ libstdc++-v3/src/c++11/random.cc	(working copy)
>@@ -31,6 +31,7 @@
> # include <cpuid.h>
> #endif
>
>+#include <cerrno>
> #include <cstdio>
>
> #ifdef _GLIBCXX_HAVE_UNISTD_H
Moore, Catherine Sept. 17, 2015, 10:32 p.m. UTC | #2
> -----Original Message-----
> From: gcc-patches-owner@gcc.gnu.org [mailto:gcc-patches-
> owner@gcc.gnu.org] On Behalf Of Jonathan Wakely
> Sent: Thursday, September 17, 2015 5:28 PM
> To: Gerald Pfeifer
> Cc: libstdc++@gcc.gnu.org; gcc-patches@gcc.gnu.org
> Subject: Re: [patch] libstdc++/65142 Check read() result in
> std::random_device.
> 
> On 17/09/15 22:21 +0200, Gerald Pfeifer wrote:
> >On Thu, 17 Sep 2015, Jonathan Wakely wrote:
> >>> Any comments on this version?
> >> Committed to trunk.
> >
> >Unfortunately this broke bootstrap on FreeBSD 10.1.
> >
> >/scratch/tmp/gerald/gcc-HEAD/libstdc++-v3/src/c++11/random.cc: In
> member function 'std::random_device::result_type
> std::random_device::_M_getval()':
> >/scratch/tmp/gerald/gcc-HEAD/libstdc++-v3/src/c++11/random.cc:144:22:
> >error: 'errno' was not declared in this scope
> >  else if (e != -1 || errno != EINTR)
> >                      ^
> >/scratch/tmp/gerald/gcc-HEAD/libstdc++-v3/src/c++11/random.cc:144:31:
> >error: 'EINTR' was not declared in this scope
> >  else if (e != -1 || errno != EINTR)
> >                               ^
> >Makefile:545: recipe for target 'random.lo' failed
> >
> >I probably won't be able to dig in deeper today, but figured this might
> >already send you on the right path?
> >
> >Actually...
> >
> >...how about he patch below?  Bootstraps on i386-unknown-freebsd10.1,
> >no regressions.
> 
> Sorry about that, I've committed your patch.
> 
> >Gerald
> >
> >
I'm still seeing errors for a build of the mips-sde-elf target with these patches.

Errors are:
/scratch/cmoore/virgin-upstream-elf-lite/src/gcc-trunk-5/libstdc++-v3/src/c++11/debug.cc: In function 'void {anonymous}::print_word({anonymous
}::PrintContext&, const char*, std::ptrdiff_t)':
/scratch/cmoore/virgin-upstream-elf-lite/src/gcc-trunk-5/libstdc++-v3/src/c++11/debug.cc:573:10: error: 'stderr' was not declared in this scop
e
  fprintf(stderr, "\n");
          ^
/scratch/cmoore/virgin-upstream-elf-lite/src/gcc-trunk-5/libstdc++-v3/src/c++11/debug.cc:573:22: error: 'fprintf' was not declared in this sco
pe
  fprintf(stderr, "\n");
                      ^
/scratch/cmoore/virgin-upstream-elf-lite/src/gcc-trunk-5/libstdc++-v3/src/c++11/debug.cc:596:14: error: 'stderr' was not declared in this scop
e
      fprintf(stderr, "%s", spacing);
              ^
/scratch/cmoore/virgin-upstream-elf-lite/src/gcc-trunk-5/libstdc++-v3/src/c++11/debug.cc:596:35: error: 'fprintf' was not declared in this sco
pe
      fprintf(stderr, "%s", spacing);
                                   ^
/scratch/cmoore/virgin-upstream-elf-lite/src/gcc-trunk-5/libstdc++-v3/src/c++11/debug.cc:600:24: error: 'stderr' was not declared in this scope
  int written = fprintf(stderr, "%s", word);
                        ^
/scratch/cmoore/virgin-upstream-elf-lite/src/gcc-trunk-5/libstdc++-v3/src/c++11/debug.cc:600:42: error: 'fprintf' was not declared in this scop
e
  int written = fprintf(stderr, "%s", word);
                                          ^

Thanks,
Catherine
Jonathan Wakely Sept. 17, 2015, 10:54 p.m. UTC | #3
On 17/09/15 22:32 +0000, Moore, Catherine wrote:
>
>
>> -----Original Message-----
>> From: gcc-patches-owner@gcc.gnu.org [mailto:gcc-patches-
>> owner@gcc.gnu.org] On Behalf Of Jonathan Wakely
>> Sent: Thursday, September 17, 2015 5:28 PM
>> To: Gerald Pfeifer
>> Cc: libstdc++@gcc.gnu.org; gcc-patches@gcc.gnu.org
>> Subject: Re: [patch] libstdc++/65142 Check read() result in
>> std::random_device.
>>
>> On 17/09/15 22:21 +0200, Gerald Pfeifer wrote:
>> >On Thu, 17 Sep 2015, Jonathan Wakely wrote:
>> >>> Any comments on this version?
>> >> Committed to trunk.
>> >
>> >Unfortunately this broke bootstrap on FreeBSD 10.1.
>> >
>> >/scratch/tmp/gerald/gcc-HEAD/libstdc++-v3/src/c++11/random.cc: In
>> member function 'std::random_device::result_type
>> std::random_device::_M_getval()':
>> >/scratch/tmp/gerald/gcc-HEAD/libstdc++-v3/src/c++11/random.cc:144:22:
>> >error: 'errno' was not declared in this scope
>> >  else if (e != -1 || errno != EINTR)
>> >                      ^
>> >/scratch/tmp/gerald/gcc-HEAD/libstdc++-v3/src/c++11/random.cc:144:31:
>> >error: 'EINTR' was not declared in this scope
>> >  else if (e != -1 || errno != EINTR)
>> >                               ^
>> >Makefile:545: recipe for target 'random.lo' failed
>> >
>> >I probably won't be able to dig in deeper today, but figured this might
>> >already send you on the right path?
>> >
>> >Actually...
>> >
>> >...how about he patch below?  Bootstraps on i386-unknown-freebsd10.1,
>> >no regressions.
>>
>> Sorry about that, I've committed your patch.
>>
>> >Gerald
>> >
>> >
>I'm still seeing errors for a build of the mips-sde-elf target with these patches.
>
>Errors are:
>/scratch/cmoore/virgin-upstream-elf-lite/src/gcc-trunk-5/libstdc++-v3/src/c++11/debug.cc: In function 'void {anonymous}::print_word({anonymous
>}::PrintContext&, const char*, std::ptrdiff_t)':
>/scratch/cmoore/virgin-upstream-elf-lite/src/gcc-trunk-5/libstdc++-v3/src/c++11/debug.cc:573:10: error: 'stderr' was not declared in this scop
>e
>  fprintf(stderr, "\n");
>          ^
>/scratch/cmoore/virgin-upstream-elf-lite/src/gcc-trunk-5/libstdc++-v3/src/c++11/debug.cc:573:22: error: 'fprintf' was not declared in this sco
>pe
>  fprintf(stderr, "\n");
>                      ^
>/scratch/cmoore/virgin-upstream-elf-lite/src/gcc-trunk-5/libstdc++-v3/src/c++11/debug.cc:596:14: error: 'stderr' was not declared in this scop
>e
>      fprintf(stderr, "%s", spacing);
>              ^
>/scratch/cmoore/virgin-upstream-elf-lite/src/gcc-trunk-5/libstdc++-v3/src/c++11/debug.cc:596:35: error: 'fprintf' was not declared in this sco
>pe
>      fprintf(stderr, "%s", spacing);
>                                   ^
>/scratch/cmoore/virgin-upstream-elf-lite/src/gcc-trunk-5/libstdc++-v3/src/c++11/debug.cc:600:24: error: 'stderr' was not declared in this scope
>  int written = fprintf(stderr, "%s", word);
>                        ^
>/scratch/cmoore/virgin-upstream-elf-lite/src/gcc-trunk-5/libstdc++-v3/src/c++11/debug.cc:600:42: error: 'fprintf' was not declared in this scop
>e
>  int written = fprintf(stderr, "%s", word);

That's a different problem, due to https://gcc.gnu.org/r227885

François, could you take a look please?
diff mbox

Patch

Index: libstdc++-v3/src/c++11/random.cc
===================================================================
--- libstdc++-v3/src/c++11/random.cc	(revision 227883)
+++ libstdc++-v3/src/c++11/random.cc	(working copy)
@@ -31,6 +31,7 @@ 
 # include <cpuid.h>
 #endif
 
+#include <cerrno>
 #include <cstdio>
 
 #ifdef _GLIBCXX_HAVE_UNISTD_H