Bug 72769 - ifstream Optimed Out ?
Summary: ifstream Optimed Out ?
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 6.1.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-01 15:09 UTC by Roy Bellingan
Modified: 2018-05-20 16:50 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2018-02-20 00:00:00


Attachments
the ii file (122.78 KB, text/plain)
2016-08-01 15:09 UTC, Roy Bellingan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Roy Bellingan 2016-08-01 15:09:21 UTC
Created attachment 39041 [details]
the ii file

This is my first bug report so be patient!

g++ version is 6.1.1 20160707 [gcc-6-branch revision 238088]
Full compilation flag are those https://gist.github.com/RoyBellingan/be151f3d22e7e0a50143d5dde622baba

System type is uname --all
Linux linux-gzgr 4.6.2-1-default #1 SMP PREEMPT Fri Jun 10 08:12:44 UTC 2016 (2a68ef0) x86_64 x86_64 x86_64 GNU/Linux

The invocation line is 

g++-6 -save-temps -O2 campaigns/1350_tmp.cpp -std=c++11 -g -o campaigns/1350_3.so -shared -fPIC -Wall -Wconversion -Wsign-compare -pedantic-errors -I data/

Output given is https://gist.github.com/RoyBellingan/7c09b6bf8908f62b9052575bf14cf43d just some warning of non used variable (this code is create dynamically and loaded via dlopen)

The .ii file is attached

In short the at line 37937 of the ii file
while (infile >> a){
fails because a is set to 0 WHEN the compiler is invoked with O2 (and also with O1)

If I use O0 a is assigned the correct value ...

For now a "fix" is to force swap the first line in a std:string (the two empty line at 37935 & 37936

	unsigned long long a;
	std::ifstream infile("campaigns/1350_ids");
	std::string cry;
	infile >> cry;
	while (infile >> a){
		ids.insert(std::pair<unsigned long long,bool>(a,1));
	}

The 1350_ids file contains a list of id to check some rows are here https://gist.github.com/RoyBellingan/8dcde8d63001dfcd438ccf9921f60627

Hope is enought!
Comment 1 Markus Trippelsdorf 2016-08-01 15:25:10 UTC
Please try to reduce the issue as much as possible. 37978 lines is much too large.

A library is unusable for testing. Please provide a standalone testcase (with "int main()", that can be run directly.).

Also try to compile and run with -fsanitize=undefined and see if anything pops up.
Comment 2 Markus Trippelsdorf 2016-08-05 09:00:13 UTC
No feedback, no suitable testcase. Closing.
Comment 3 Roy Bellingan 2016-08-05 13:30:23 UTC
No wait I was quite busy -.-
Ok to keep close for now, I will try to provide better info soon.
Comment 4 Eric Gallager 2018-02-20 10:42:55 UTC
(In reply to Roy Bellingan from comment #3)
> No wait I was quite busy -.-
> Ok to keep close for now, I will try to provide better info soon.

Putting in WAITING until then
Comment 5 Eric Gallager 2018-05-20 16:50:52 UTC
(In reply to Eric Gallager from comment #4)
> (In reply to Roy Bellingan from comment #3)
> > No wait I was quite busy -.-
> > Ok to keep close for now, I will try to provide better info soon.
> 
> Putting in WAITING until then

...and closing again, since there's still no better info.