public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "in-gnu at baka dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/47255] New: Missed optimization with loops, inline functions, and __attribute__((const)) Date: Tue, 11 Jan 2011 04:41:00 -0000 [thread overview] Message-ID: <bug-47255-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47255 Summary: Missed optimization with loops, inline functions, and __attribute__((const)) Product: gcc Version: 4.5.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned@gcc.gnu.org ReportedBy: in-gnu@baka.org Created attachment 22942 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22942 Test program exhibiting missed optimization Using gcc 4.5.2 on gentoo (or gcc 4.1.2 on RHEL 5.5), gcc fails to optimize a case where a const function is called in a const way inside a loop, if the const function is elgible for inlining. The test case should print three lines if it succeeds. In fact, the "World" line is printed once per loop iteration. How-To-Repeat: Compile the attach test-case with -O3 or "-O -finline-small-functions -finline-functions" -- more than three lines are printed. Compile with -O2, the correct number of lines (three) for full optimization are printed. Release: ---------------------------------------------------------------------- Using built-in specs. Target: x86_64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux Thread model: posix gcc version 4.1.2 20080704 (Red Hat 4.1.2-48) ---------------------------------------------------------------------- Using built-in specs. COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/4.5.2/gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.5.2/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /n/startide/proj/startide/var-tmp/portage/sys-devel/gcc-4.5.2/work/gcc-4.5.2/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.5.2 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.2/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.5.2 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.5.2/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.5.2/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.2/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --without-ppl --without-cloog --disable-lto --enable-nls --without-included-gettext --with-system-zlib --disable-werror --enable-secureplt --enable-multilib --enable-libmudflap --disable-libssp --enable-libgomp --enable-cld --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.5.2/python --enable-checking=release --disable-libgcj --enable-languages=c,c++ --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.5.2 p1.0, pie-0.4.5' Thread model: posix gcc version 4.5.2 (Gentoo 4.5.2 p1.0, pie-0.4.5) ----------------------------------------------------------------------
next reply other threads:[~2011-01-11 2:35 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-01-11 4:41 in-gnu at baka dot org [this message] 2011-01-11 12:40 ` [Bug c/47255] " rguenth at gcc dot gnu.org 2011-01-11 18:48 ` in-gnu at baka dot org 2011-01-12 11:59 ` [Bug tree-optimization/47255] Missed CSE optimization with " rguenth at gcc dot gnu.org 2011-02-07 10:58 ` bonzini at gnu dot org 2011-02-07 16:52 ` in-gnu at baka dot org 2021-11-28 4:54 ` pinskia at gcc dot gnu.org 2024-03-11 12:04 ` pinskia at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-47255-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).