Bug 98738
Summary: | gcc3.3 (& 3.2) mishandling fstreams. | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [Retired] Red Hat Raw Hide | Reporter: | Kyriakos Sidiropoulos <ksidirop> | ||||||
Component: | gcc3 | Assignee: | Jakub Jelinek <jakub> | ||||||
Status: | CLOSED NOTABUG | QA Contact: | |||||||
Severity: | high | Docs Contact: | |||||||
Priority: | high | ||||||||
Version: | 1.0 | ||||||||
Target Milestone: | --- | ||||||||
Target Release: | --- | ||||||||
Hardware: | xscale | ||||||||
OS: | Linux | ||||||||
Whiteboard: | |||||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||||
Doc Text: | Story Points: | --- | |||||||
Clone Of: | Environment: | ||||||||
Last Closed: | 2003-07-08 15:07:51 UTC | Type: | --- | ||||||
Regression: | --- | Mount Type: | --- | ||||||
Documentation: | --- | CRM: | |||||||
Verified Versions: | Category: | --- | |||||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||
Cloudforms Team: | --- | Target Upstream Version: | |||||||
Embargoed: | |||||||||
Attachments: |
|
Description
Kyriakos Sidiropoulos
2003-07-08 10:38:03 UTC
Created attachment 92792 [details]
source and precompiled source
It's interesting the way the problem occurs at an other platform: bash-2.05$ uname -a SunOS venus 5.9 Generic_112233-04 sun4u sparc SUNW,Ultra-30 bash-2.05$ gcc --version gcc (GCC) 3.2.2 Copyright (C) 2002 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. bash-2.05$ ls -l /usr/local/lib/libstdc++.so* lrwxrwxrwx 1 root other 18 Mar 12 17:07 /usr/local/lib/libstdc++.so -> libstdc++.so.5.0.2 lrwxrwxrwx 1 root other 18 Mar 12 17:07 /usr/local/lib/libstdc++.so.5 -> libstdc++.so.5.0.2 -rwxr-xr-x 1 bin bin 8151688 Feb 10 12:22 /usr/local/lib/libstdc++.so.5.0.2 bash-2.05$ make clean && make ... ... For _this_ platform the problem occurs IF the files I am trying to create do not exist in the first place. Hence: bash-2.05$ bash-2.05$ ( rm ./foo/.* || : ) && ./nfc.out [same params ...] ... Abort (core dumped) ------------------------------------------------------------------- BUT if I `touch' these files first to create them manually and then run `./nfc.out' the problem goes away: bash-2.05$ ( rm ./foo/.* || : ) && touch foo/{.AllOfInflow.tmp,.AllOfOutflow.tmp} && ./nfc.out [usual params ...] ... (no problem ...) ... Hope this proves useful. Created attachment 92793 [details]
procompiled source from SUNOS platform with gcc 3.2.2
OK. The one who can give an me an explanation of what goes wrong here (other than that I am dealing with a bug) is granted permission to shoot me in the head. Open file: srcs/main.c++. After these lines: int main( int argc, char * argv[]) { SystemInteraction SysArgs( argc, argv); ... Insert this line: std::ofstream AllInflowFile( "blah_blah"); Write the file out and: "make clean && make" the program. Now run: bash # ./nfc.out 2003 06 27 --output-directory=./foo/ \ --ip-directory=input/1_IPs_to_search --server-name=olympos-e43 \ --basic-directory-of-nodes=./input/ The program will sigsegv as usual uppon the line we inserted above. --------------------------------------------------------------------- Now open file: srcs/SystemInteraction.c++. At the constructor `SystemInteraction( ...)' delete/comment the line: " delete[] argv;" Now recompile the program the usual way and run it the usual way: bash # ./nfc.out 2003 06 27 --output-directory=./foo/ \ --ip-directory=input/1_IPs_to_search --server-name=olympos-e43 \ --basic-directory-of-nodes=./input/ It won't sigsegv at the points it used too. First of all, bugzilla is not a support forum, it is a place where to report bugs in the packages shipped in the distribution. Doing a delete[] argv; on the array passed to main is certainly a fatal bug, that array is not malloced so cannot be freed. You either have to make a copy of the array if you wish to free it, or you cannot free it. Doing free(3) something that has not been obtained by malloc(3), calloc(3) or realloc(3) means anything can be broken since then in the allocator data structures, so any *alloc call or free call later on can crash. |