public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/44574] Avoid use of atoi
       [not found] <bug-44574-4@http.gcc.gnu.org/bugzilla/>
@ 2010-11-18 23:21 ` pinskia at gcc dot gnu.org
  2011-05-12 21:51 ` jsm28 at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2010-11-18 23:21 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44574

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2010.11.18 22:32:30
     Ever Confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2010-11-18 22:32:30 UTC ---
Confirmed.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug other/44574] Avoid use of atoi
       [not found] <bug-44574-4@http.gcc.gnu.org/bugzilla/>
  2010-11-18 23:21 ` [Bug other/44574] Avoid use of atoi pinskia at gcc dot gnu.org
@ 2011-05-12 21:51 ` jsm28 at gcc dot gnu.org
  2021-08-24  8:27 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2011-05-12 21:51 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44574

--- Comment #2 from Joseph S. Myers <jsm28 at gcc dot gnu.org> 2011-05-12 21:08:14 UTC ---
There are also uses of atol, atoll and atoq to eliminate.  Also note some Ada
code using atoi (surely there must be a more idiomatic Ada way of doing this?).
 It would be best to poison all these functions when the uses are eliminated. 
In some cases the use of atoi may be allowing a wider range of inputs (in terms
of leading whitespace and trailing unrecognized characters) than should
actually be allowed in the context.

libiberty has a use of atoi in cplus-dem.c that is harmless (it's only used on
a single-digit string) but pointless (C guarantees that the digit characters
have consecutive integer values so you can just subtract '0', and this
guarantee is already in C90).


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug other/44574] Avoid use of atoi
       [not found] <bug-44574-4@http.gcc.gnu.org/bugzilla/>
  2010-11-18 23:21 ` [Bug other/44574] Avoid use of atoi pinskia at gcc dot gnu.org
  2011-05-12 21:51 ` jsm28 at gcc dot gnu.org
@ 2021-08-24  8:27 ` pinskia at gcc dot gnu.org
  2023-06-01  9:39 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-24  8:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44574

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2010-11-18 22:32:30         |2021-8-24
           Keywords|                            |internal-improvement

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Here is the list of files which currently use ato{l,ll,i,q} in whole of gcc
source base

gcc directory:
ada/libgnat/s-crtl.ads
ada/libgnat/s-stausa.adb
ada/libgnat/s-stchop.adb
ada/raise-gcc.c
ada/sysdep.c
c/gimple-parser.c
collect2.c
config/cris/cris.c
config/frv/frv.c
config/host-linux.c
config/msp430/driver-msp430.c
config/msp430/msp430-devices.c
config/nds32/nds32-isr.c
config/nios2/nios2.c
config/rs6000/rs6000.c
diagnostic.c
fortran/error.c
fortran/scanner.c
genattrtab.c
genautomata.c
lto-wrapper.c
lto/lto.c
opts.c
read-rtl-function.c
read-rtl.c
varasm.c


libobjc directory:
encoding.c
gc.c

libgfortran:
io/write_float.def
runtime/environ.c

liboffloadmic:
runtime/emulator/coi_device.cpp
runtime/offload_host.cpp
runtime/offload_target.cpp

libvtv:
vtv_rts.cc

fixincludes:
fixincl.c

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug other/44574] Avoid use of atoi
       [not found] <bug-44574-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2021-08-24  8:27 ` pinskia at gcc dot gnu.org
@ 2023-06-01  9:39 ` redi at gcc dot gnu.org
  2024-04-01  4:33 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2023-06-01  9:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44574

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Now that we have C++11 we could use std::stoi, std::stol, std::stoul etc. ...
except that they throw exceptions to report out of range values :-(

std::from_chars isn't available until C++17.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug other/44574] Avoid use of atoi
       [not found] <bug-44574-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2023-06-01  9:39 ` redi at gcc dot gnu.org
@ 2024-04-01  4:33 ` pinskia at gcc dot gnu.org
  2024-04-01  4:52 ` [Bug other/44574] [meta-bug] " pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-01  4:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44574

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note I filed PR 114540 for the usage in varasm.cc (decode_reg_name_and_count) 
as you can come up with a few testcases where we don't reject invalid registers
# when we should.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug other/44574] [meta-bug] Avoid use of atoi
       [not found] <bug-44574-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2024-04-01  4:33 ` pinskia at gcc dot gnu.org
@ 2024-04-01  4:52 ` pinskia at gcc dot gnu.org
  2024-04-01  4:57 ` pinskia at gcc dot gnu.org
  2024-04-01  5:05 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-01  4:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44574

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Avoid use of atoi           |[meta-bug] Avoid use of
                   |                            |atoi
           Keywords|                            |meta-bug

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>c/gimple-parser.c

PR  114541 since I found a testcase .

This is turning into a meta-bug so let's turn it into a full one then.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug other/44574] [meta-bug] Avoid use of atoi
       [not found] <bug-44574-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2024-04-01  4:52 ` [Bug other/44574] [meta-bug] " pinskia at gcc dot gnu.org
@ 2024-04-01  4:57 ` pinskia at gcc dot gnu.org
  2024-04-01  5:05 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-01  4:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44574

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>read-rtl-function.c

Someone most likely can come up with a testcase for this one using the RTL
parser.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug other/44574] [meta-bug] Avoid use of atoi
       [not found] <bug-44574-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2024-04-01  4:57 ` pinskia at gcc dot gnu.org
@ 2024-04-01  5:05 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-01  5:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44574

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
> opts.c
> lto-wrapper.c
> lto/lto.c

These 3 are all about parsing of -flto=N option; PR 114542

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-04-01  5:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-44574-4@http.gcc.gnu.org/bugzilla/>
2010-11-18 23:21 ` [Bug other/44574] Avoid use of atoi pinskia at gcc dot gnu.org
2011-05-12 21:51 ` jsm28 at gcc dot gnu.org
2021-08-24  8:27 ` pinskia at gcc dot gnu.org
2023-06-01  9:39 ` redi at gcc dot gnu.org
2024-04-01  4:33 ` pinskia at gcc dot gnu.org
2024-04-01  4:52 ` [Bug other/44574] [meta-bug] " pinskia at gcc dot gnu.org
2024-04-01  4:57 ` pinskia at gcc dot gnu.org
2024-04-01  5:05 ` pinskia at gcc dot gnu.org

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).