public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/103323] New: Front end simplifies sin although no header included
@ 2021-11-18 20:29 tkoenig at gcc dot gnu.org
  2021-11-18 20:39 ` [Bug c/103323] " pinskia at gcc dot gnu.org
  2021-11-18 21:20 ` tkoenig at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2021-11-18 20:29 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103323
           Summary: Front end simplifies sin although no header included
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tkoenig at gcc dot gnu.org
  Target Milestone: ---

$ cat a.c
double 
sin(double x) {
  return x/2 + x;
}

double
foo(double x) {
  return 1 - sin(-x);
}
$ gcc -S -fdump-tree-original a.c 
$ cat a.c.005t.original 

;; Function sin (null)
;; enabled by -tree-original


{
  return x / 2.0e+0 + x;
}


;; Function foo (null)
;; enabled by -tree-original


{
  return sin (x) + 1.0e+0;
}

$ gcc -v
Es werden eingebaute Spezifikationen verwendet.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/ig25/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Ziel: x86_64-pc-linux-gnu
Konfiguriert mit: ../trunk/configure --prefix=/home/ig25
--enable-languages=c,c++,fortran --enable-maintainer-mode
Thread-Modell: posix
Unterstützte LTO-Kompressionsalgorithmen: zlib
gcc-Version 12.0.0 20211116 (experimental) [master revision
e87559d202d:f4e6da6e8ac:36ec54aac7da134441c83248e14825381b8d6f17] (GCC) 

The sin(x) in the tree dump should be sin(-x).

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

* [Bug c/103323] Front end simplifies sin although no header included
  2021-11-18 20:29 [Bug c/103323] New: Front end simplifies sin although no header included tkoenig at gcc dot gnu.org
@ 2021-11-18 20:39 ` pinskia at gcc dot gnu.org
  2021-11-18 21:20 ` tkoenig at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-18 20:39 UTC (permalink / raw)
  To: gcc-bugs

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

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> ---
sin is a reserved symbol in c, you need to use -fno-builtins if you don't want
the optimization.

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

* [Bug c/103323] Front end simplifies sin although no header included
  2021-11-18 20:29 [Bug c/103323] New: Front end simplifies sin although no header included tkoenig at gcc dot gnu.org
  2021-11-18 20:39 ` [Bug c/103323] " pinskia at gcc dot gnu.org
@ 2021-11-18 21:20 ` tkoenig at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2021-11-18 21:20 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=51437

--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> sin is a reserved symbol in c, you need to use -fno-builtins if you don't
> want the optimization.

Ah, correct.

I also see that PR 51437 has the request for a warning.

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

end of thread, other threads:[~2021-11-18 21:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-18 20:29 [Bug c/103323] New: Front end simplifies sin although no header included tkoenig at gcc dot gnu.org
2021-11-18 20:39 ` [Bug c/103323] " pinskia at gcc dot gnu.org
2021-11-18 21:20 ` tkoenig 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).