[Bug 1303028] Re: fscanf is not behaving as expected under certain circumstances
Kajetan
kajetan.krischan at gmail.com
Sun Apr 6 15:13:43 UTC 2014
I'm sorry, I was quite sure that it was a bug in this version of the
compiler because it worked in version 4.8
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-4.6 in Ubuntu.
https://bugs.launchpad.net/bugs/1303028
Title:
fscanf is not behaving as expected under certain circumstances
Status in “gcc-4.6” package in Ubuntu:
Invalid
Bug description:
When I compile the attached program I do not get any errors or warnings. When I execute it it causes a segmentation fault at the last call of fscanf and something strange happens: the index ('z') gets the value that the variable ('core') should get.
This causes fclose to close the wrong file which then leads to the segmentation fault.
This only happens when the last two digits (in binary) of 'CORECOUNT' are '1' (e.g. CORECOUNT=3 (00000011)).
When declaring another integer (e.g. tmp) and setting it to 0 the program works as expected when the last two binary digits of 'CORECOUNT' are '1'. When this is not the case (e.g. 'CORECOUNT'=4) the program won't work anymore and might in some cases segfault.
OS: Ubuntu 12.04.4 LTS (via 'lsb_release -rd')
version of gcc: 4.6.3-1ubuntu5 (via 'apt-cache policy gcc'; for more details see below)
This program does not work on other computers with gcc 4.6 but it
works with gcc 4.8
$ apt-cache policy gcc
gcc:
Installed: 4:4.6.3-1ubuntu5
Candidate: 4:4.6.3-1ubuntu5
Version table:
*** 4:4.6.3-1ubuntu5 0
500 http://at.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
100 /var/lib/dpkg/status
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.6/+bug/1303028/+subscriptions
More information about the foundations-bugs
mailing list