This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/57937] New: fgets and cout tricky bug
- From: "linkerpro at mail dot ru" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 19 Jul 2013 21:07:51 +0000
- Subject: [Bug c++/57937] New: fgets and cout tricky bug
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57937
Bug ID: 57937
Summary: fgets and cout tricky bug
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: linkerpro at mail dot ru
Created attachment 30529
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30529&action=edit
code demostrating the bug
Hi
It's seem I have found very tricky bug while trying to resolve MAC addr by IP
in my local network.
Requerement: to use see the bug - at line 50 of attachment you should put a
real host in your local network, and this host must be present in arp table. In
my case 192.168.1.1 is my gateway.
compiles OK without any warning
$ g++ bug.cpp --std=c++0x -Wall -Wextra
run (no output)
$ ./a.out
$
Next uncomment line 36 of attachment (simple debug cout) !
recompile OK
$ g++ bug.cpp --std=c++0x -Wall -Wextra
run OK
$ ./a.out
> 192.168.1.1
00:01:02:03:04:05
So if I put any cout in for loop - everything is OK.
Ubuntu 12.10 with latest updates.
$ uname -a
Linux notebook 3.5.0-36-generic #57-Ubuntu SMP Wed Jun 19 15:10:49 UTC 2013
x86_64 x86_64 x86_64 GNU/Linux