public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/101964] New: using scanf makes compiler never terminate
@ 2021-08-18 18:01 mateusmoraisdias3 at gmail dot com
2021-08-18 18:05 ` [Bug c/101964] " pinskia at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: mateusmoraisdias3 at gmail dot com @ 2021-08-18 18:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101964
Bug ID: 101964
Summary: using scanf makes compiler never terminate
Product: gcc
Version: 11.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: mateusmoraisdias3 at gmail dot com
Target Milestone: ---
OS: 5.13.8-1-MANJARO - x86_64
Description:
using a simple call with `scanf` makes gcc never compile the source. Even a
file (the bin output) is created, but once ran nothing happens, as it were
stuck in a empty loop.
Steps to reproduce:
write a file with this content
```c
#!/main.c
#include <stdio.h>
int main(){
int x;
scanf("%d", x);
return 0;
}
```
type `gcc main.c -o main` to compile.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/101964] using scanf makes compiler never terminate
2021-08-18 18:01 [Bug c/101964] New: using scanf makes compiler never terminate mateusmoraisdias3 at gmail dot com
@ 2021-08-18 18:05 ` pinskia at gcc dot gnu.org
2021-08-18 18:05 ` pinskia at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-18 18:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101964
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
<source>:6:13: warning: format '%d' expects argument of type 'int*', but
argument 2 has type 'int' [-Wformat=]
6 | scanf("%d", x);
| ~^ ~
| | |
| | int
| int*
<source>:6:10: warning: 'x' is used uninitialized [-Wuninitialized]
6 | scanf("%d", x);
| ~~~~~^~~~~~~~~
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/101964] using scanf makes compiler never terminate
2021-08-18 18:01 [Bug c/101964] New: using scanf makes compiler never terminate mateusmoraisdias3 at gmail dot com
2021-08-18 18:05 ` [Bug c/101964] " pinskia at gcc dot gnu.org
@ 2021-08-18 18:05 ` pinskia at gcc dot gnu.org
2021-08-19 7:29 ` marxin at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-18 18:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101964
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|INVALID |---
Status|RESOLVED |UNCONFIRMED
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Works for me.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/101964] using scanf makes compiler never terminate
2021-08-18 18:01 [Bug c/101964] New: using scanf makes compiler never terminate mateusmoraisdias3 at gmail dot com
2021-08-18 18:05 ` [Bug c/101964] " pinskia at gcc dot gnu.org
2021-08-18 18:05 ` pinskia at gcc dot gnu.org
@ 2021-08-19 7:29 ` marxin at gcc dot gnu.org
2021-08-20 19:47 ` mateusmoraisdias3 at gmail dot com
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-08-19 7:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101964
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |marxin at gcc dot gnu.org
Resolution|--- |INVALID
Status|UNCONFIRMED |RESOLVED
--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Same for me.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/101964] using scanf makes compiler never terminate
2021-08-18 18:01 [Bug c/101964] New: using scanf makes compiler never terminate mateusmoraisdias3 at gmail dot com
` (2 preceding siblings ...)
2021-08-19 7:29 ` marxin at gcc dot gnu.org
@ 2021-08-20 19:47 ` mateusmoraisdias3 at gmail dot com
2021-08-23 9:25 ` redi at gcc dot gnu.org
2021-08-23 18:11 ` mateusmoraisdias3 at gmail dot com
5 siblings, 0 replies; 7+ messages in thread
From: mateusmoraisdias3 at gmail dot com @ 2021-08-20 19:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101964
--- Comment #4 from Mateus Morais Dias de Souza <mateusmoraisdias3 at gmail dot com> ---
I figured it out. My build script was something like this:
```bash
set -e
gcc main.c -o main
./main
```
for some reason gcc was not warning about my unseen error, then it ran the
program (because I forgot that it was encoded to run after building) and I
didn't notice. Running directly the gcc line into the terminal didn't show me
the warning too. But anyway, problem solved.
Sorry for openning a false-positive issue. Closing it now.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/101964] using scanf makes compiler never terminate
2021-08-18 18:01 [Bug c/101964] New: using scanf makes compiler never terminate mateusmoraisdias3 at gmail dot com
` (3 preceding siblings ...)
2021-08-20 19:47 ` mateusmoraisdias3 at gmail dot com
@ 2021-08-23 9:25 ` redi at gcc dot gnu.org
2021-08-23 18:11 ` mateusmoraisdias3 at gmail dot com
5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2021-08-23 9:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101964
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Mateus Morais Dias de Souza from comment #4)
> I figured it out. My build script was something like this:
> ```bash
> set -e
> gcc main.c -o main
> ./main
> ```
> for some reason gcc was not warning about my unseen error,
Because you didn't tell it to.
Use -Wall to enable warnings. I asked you to read https://gcc.gnu.org/bugs/
before reporting the bug, and one of the things that tells you to do is enable
warnings.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/101964] using scanf makes compiler never terminate
2021-08-18 18:01 [Bug c/101964] New: using scanf makes compiler never terminate mateusmoraisdias3 at gmail dot com
` (4 preceding siblings ...)
2021-08-23 9:25 ` redi at gcc dot gnu.org
@ 2021-08-23 18:11 ` mateusmoraisdias3 at gmail dot com
5 siblings, 0 replies; 7+ messages in thread
From: mateusmoraisdias3 at gmail dot com @ 2021-08-23 18:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101964
--- Comment #6 from Mateus Morais Dias de Souza <mateusmoraisdias3 at gmail dot com> ---
I was a wrong of me, my apologizes. I'll not do it again
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-08-23 18:11 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-18 18:01 [Bug c/101964] New: using scanf makes compiler never terminate mateusmoraisdias3 at gmail dot com
2021-08-18 18:05 ` [Bug c/101964] " pinskia at gcc dot gnu.org
2021-08-18 18:05 ` pinskia at gcc dot gnu.org
2021-08-19 7:29 ` marxin at gcc dot gnu.org
2021-08-20 19:47 ` mateusmoraisdias3 at gmail dot com
2021-08-23 9:25 ` redi at gcc dot gnu.org
2021-08-23 18:11 ` mateusmoraisdias3 at gmail dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).