public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/52592] New: mplayer compilation failure with undefined reference to `__builtin_iround'
@ 2012-03-15  5:40 ojab at ojab dot ru
  2012-03-15  6:02 ` [Bug c/52592] " pinskia at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: ojab at ojab dot ru @ 2012-03-15  5:40 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52592
           Summary: mplayer compilation failure with undefined reference
                    to `__builtin_iround'
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ojab@ojab.ru


MPlayer build fails with gcc-4.7.0rc2 (see
http://bugzilla.mplayerhq.hu/show_bug.cgi?id=2047 ):

gcc -o mencoder mencoder.o parser-mecmd.o … -lfribidi -lass -lz -lbz2 -lmad
-lvpx -lpthread -ldl -rdynamic   -lmp3lame
ffmpeg/libavcodec/libavcodec.a(ffv1.o): In function `encode_init':
ffv1.c:(.text.unlikely+0x16a1): undefined reference to `__builtin_iround'
collect2: error: ld returned 1 exit status
make: *** [mencoder] Error 1
make: *** Waiting for unfinished jobs....
ffmpeg/libavcodec/libavcodec.a(ffv1.o): In function `encode_init':
ffv1.c:(.text.unlikely+0x16a1): undefined reference to `__builtin_iround'
collect2: error: ld returned 1 exit status
make: *** [mplayer] Error 1


Looks like related to http://gcc.gnu.org/ml/gcc-patches/2011-08/msg01001.html
and 
>Please document those in doc/extend.texi and make sure they do not leak into the global namespace as ifloor, etc., but are only available as __builtin_ifloor, etc..
from http://gcc.gnu.org/ml/gcc-patches/2011-08/msg01003.html

mplayer builds fine with CFLAGS=-ffast-math, I think that it can be gcc bug.

Please tell me what additional info is needed.


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

* [Bug c/52592] mplayer compilation failure with undefined reference to `__builtin_iround'
  2012-03-15  5:40 [Bug c/52592] New: mplayer compilation failure with undefined reference to `__builtin_iround' ojab at ojab dot ru
@ 2012-03-15  6:02 ` pinskia at gcc dot gnu.org
  2012-03-15  6:04 ` [Bug middle-end/52592] " pinskia at gcc dot gnu.org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-03-15  6:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-03-15 06:00:37 UTC ---
What target is this on?


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

* [Bug middle-end/52592] mplayer compilation failure with undefined reference to `__builtin_iround'
  2012-03-15  5:40 [Bug c/52592] New: mplayer compilation failure with undefined reference to `__builtin_iround' ojab at ojab dot ru
  2012-03-15  6:02 ` [Bug c/52592] " pinskia at gcc dot gnu.org
  2012-03-15  6:04 ` [Bug middle-end/52592] " pinskia at gcc dot gnu.org
@ 2012-03-15  6:04 ` ojab at ojab dot ru
  2012-03-15  6:13 ` ojab at ojab dot ru
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: ojab at ojab dot ru @ 2012-03-15  6:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from ojab <ojab at ojab dot ru> 2012-03-15 06:04:02 UTC ---
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.7.0-RC-20120314/configure --prefix=/usr
--libexecdir=/usr/lib --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu --enable-languages=c,c++
--disable-multilib --disable-bootstrap --with-system-zlib
Thread model: posix
gcc version 4.7.0 20120314 (prerelease) (GCC)

Compilation string:
gcc -I. -I./  -DHAVE_AV_CONFIG_H -Wundef -Wall -Wno-switch -Wno-parentheses
-Wpointer-arith -Wredundant-decls -Wstrict-prototypes -Wmissing-prototypes
-Wdisabled-optimization -Wno-pointer-sign -Wdeclaration-after-statement
-std=gnu99 -Werror-implicit-function-declaration -O4 -march=native
-mtune=native -pipe -ffast-math -fomit-frame-pointer -fno-tree-vectorize
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -Ilibdvdread4
-I. -Iffmpeg  -D_REENTRANT   -I/usr/include/freetype2  -MD -MP -c -o
libavcodec/ffv1.o libavcodec/ffv1.c


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

* [Bug middle-end/52592] mplayer compilation failure with undefined reference to `__builtin_iround'
  2012-03-15  5:40 [Bug c/52592] New: mplayer compilation failure with undefined reference to `__builtin_iround' ojab at ojab dot ru
  2012-03-15  6:02 ` [Bug c/52592] " pinskia at gcc dot gnu.org
@ 2012-03-15  6:04 ` pinskia at gcc dot gnu.org
  2012-03-15  6:04 ` ojab at ojab dot ru
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-03-15  6:04 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2012-03-15
          Component|c                           |middle-end
     Ever Confirmed|0                           |1

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-03-15 06:01:53 UTC ---
Can you attach the preprocessed source for ffv1.c ?
Also can you give the exact command is used to compile ffv1.c ?


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

* [Bug middle-end/52592] mplayer compilation failure with undefined reference to `__builtin_iround'
  2012-03-15  5:40 [Bug c/52592] New: mplayer compilation failure with undefined reference to `__builtin_iround' ojab at ojab dot ru
                   ` (2 preceding siblings ...)
  2012-03-15  6:04 ` ojab at ojab dot ru
@ 2012-03-15  6:13 ` ojab at ojab dot ru
  2012-03-15  6:13 ` [Bug middle-end/52592] [4.7/4.8 Regression] " pinskia at gcc dot gnu.org
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: ojab at ojab dot ru @ 2012-03-15  6:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from ojab <ojab at ojab dot ru> 2012-03-15 06:04:38 UTC ---
Created attachment 26896
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26896
Preprocessed source


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

* [Bug middle-end/52592] [4.7/4.8 Regression] compilation failure with undefined reference to `__builtin_iround'
  2012-03-15  5:40 [Bug c/52592] New: mplayer compilation failure with undefined reference to `__builtin_iround' ojab at ojab dot ru
                   ` (3 preceding siblings ...)
  2012-03-15  6:13 ` ojab at ojab dot ru
@ 2012-03-15  6:13 ` pinskia at gcc dot gnu.org
  2012-03-15  6:44 ` pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-03-15  6:13 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |link-failure, wrong-code
             Target|                            |x86_64-*-linux-gnu
             Status|WAITING                     |NEW
   Target Milestone|---                         |4.7.0
            Summary|mplayer compilation failure |[4.7/4.8 Regression]
                   |with undefined reference to |compilation failure with
                   |`__builtin_iround'          |undefined reference to
                   |                            |`__builtin_iround'
           Severity|normal                      |critical

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-03-15 06:13:11 UTC ---
Reducing a testcase.


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

* [Bug middle-end/52592] [4.7/4.8 Regression] compilation failure with undefined reference to `__builtin_iround'
  2012-03-15  5:40 [Bug c/52592] New: mplayer compilation failure with undefined reference to `__builtin_iround' ojab at ojab dot ru
                   ` (4 preceding siblings ...)
  2012-03-15  6:13 ` [Bug middle-end/52592] [4.7/4.8 Regression] " pinskia at gcc dot gnu.org
@ 2012-03-15  6:44 ` pinskia at gcc dot gnu.org
  2012-03-15  7:11 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-03-15  6:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-03-15 06:13:42 UTC ---
Note a simple testcase works correctly.


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

* [Bug middle-end/52592] [4.7/4.8 Regression] compilation failure with undefined reference to `__builtin_iround'
  2012-03-15  5:40 [Bug c/52592] New: mplayer compilation failure with undefined reference to `__builtin_iround' ojab at ojab dot ru
                   ` (5 preceding siblings ...)
  2012-03-15  6:44 ` pinskia at gcc dot gnu.org
@ 2012-03-15  7:11 ` pinskia at gcc dot gnu.org
  2012-03-15  7:22 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-03-15  7:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-03-15 06:43:55 UTC ---
Reduced testcase:
  int best_state[256][256];
 __attribute__((cold)) 
int encode_init(double p) {
  return best_state[(int)round(p)][0];
}

--- CUT ---
(define_expand "lround<X87MODEF:mode><SWI248x:mode>2"
  [(match_operand:SWI248x 0 "nonimmediate_operand" "")
   (match_operand:X87MODEF 1 "register_operand" "")]
  "(TARGET_USE_FANCY_MATH_387
    && (!(SSE_FLOAT_MODE_P (<X87MODEF:MODE>mode) && TARGET_SSE_MATH)
        || TARGET_MIX_SSE_I387)
    && flag_unsafe_math_optimizations)
   || (SSE_FLOAT_MODE_P (<X87MODEF:MODE>mode) && TARGET_SSE_MATH
       && <SWI248x:MODE>mode != HImode
       && ((<SWI248x:MODE>mode != DImode) || TARGET_64BIT)
       && !flag_trapping_math && !flag_rounding_math)"
{
  if (optimize_insn_for_size_p ())
    FAIL;

--- CUT ---
Looks like there is a disconnect about when choosing iround over lround.

I bet the code that handles the expanding of __builtin_iround
(expand_builtin_int_roundingfn_2) should do exactly what the expanding of iceil
does (expand_builtin_int_roundingfn).


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

* [Bug middle-end/52592] [4.7/4.8 Regression] compilation failure with undefined reference to `__builtin_iround'
  2012-03-15  5:40 [Bug c/52592] New: mplayer compilation failure with undefined reference to `__builtin_iround' ojab at ojab dot ru
                   ` (6 preceding siblings ...)
  2012-03-15  7:11 ` pinskia at gcc dot gnu.org
@ 2012-03-15  7:22 ` pinskia at gcc dot gnu.org
  2012-03-15  7:47 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-03-15  7:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-03-15 07:10:46 UTC ---
Here is the smallest testcase:
 __attribute__((cold))
int encode_init(double p) {
 return (int)__builtin_round(p);
}
---- CUT ----
I think I have a patch, just testing it a little bit.


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

* [Bug middle-end/52592] [4.7/4.8 Regression] compilation failure with undefined reference to `__builtin_iround'
  2012-03-15  5:40 [Bug c/52592] New: mplayer compilation failure with undefined reference to `__builtin_iround' ojab at ojab dot ru
                   ` (7 preceding siblings ...)
  2012-03-15  7:22 ` pinskia at gcc dot gnu.org
@ 2012-03-15  7:47 ` pinskia at gcc dot gnu.org
  2012-03-15  9:42 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-03-15  7:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-03-15 07:25:21 UTC ---
Created attachment 26897
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26897
Patch which fixes the problem

I don't have enough time to regress test this patch though.
But here is the ChangeLog for it:
* builtins.c (expand_builtin_int_roundingfn_2): If the expanding of iround
optab fails, then expand using lround call.


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

* [Bug middle-end/52592] [4.7/4.8 Regression] compilation failure with undefined reference to `__builtin_iround'
  2012-03-15  5:40 [Bug c/52592] New: mplayer compilation failure with undefined reference to `__builtin_iround' ojab at ojab dot ru
                   ` (8 preceding siblings ...)
  2012-03-15  7:47 ` pinskia at gcc dot gnu.org
@ 2012-03-15  9:42 ` jakub at gcc dot gnu.org
  2012-03-15 13:41 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-03-15  9:42 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #26897|0                           |1
        is obsolete|                            |
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |jakub at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-03-15 09:36:02 UTC ---
Created attachment 26898
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26898
gcc47-pr52592.patch

Fixed up and simplified patch, untested so far.

I guess expand_builtin_int_roundingfn (for 4.8 only) could be simplified too,
by using mathfn_built_in_1 (, , 0); and dropping the whole if (fallback_fndecl
== NULL_TREE) { ... }.


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

* [Bug middle-end/52592] [4.7/4.8 Regression] compilation failure with undefined reference to `__builtin_iround'
  2012-03-15  5:40 [Bug c/52592] New: mplayer compilation failure with undefined reference to `__builtin_iround' ojab at ojab dot ru
                   ` (9 preceding siblings ...)
  2012-03-15  9:42 ` jakub at gcc dot gnu.org
@ 2012-03-15 13:41 ` jakub at gcc dot gnu.org
  2012-03-15 13:42 ` jakub at gcc dot gnu.org
  2012-03-15 14:18 ` jakub at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-03-15 13:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-03-15 13:30:10 UTC ---
Author: jakub
Date: Thu Mar 15 13:30:04 2012
New Revision: 185431

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=185431
Log:
    PR middle-end/52592
    * builtins.c (expand_builtin_int_roundingfn_2): If expanding
    BUILT_IN_IR{INT,OUND}* using optab fails, emit lr{int,ound}*
    calls instead of __builtin_ir{int,ound}*.

    * gcc.dg/pr52592.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/pr52592.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/builtins.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug middle-end/52592] [4.7/4.8 Regression] compilation failure with undefined reference to `__builtin_iround'
  2012-03-15  5:40 [Bug c/52592] New: mplayer compilation failure with undefined reference to `__builtin_iround' ojab at ojab dot ru
                   ` (10 preceding siblings ...)
  2012-03-15 13:41 ` jakub at gcc dot gnu.org
@ 2012-03-15 13:42 ` jakub at gcc dot gnu.org
  2012-03-15 14:18 ` jakub at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-03-15 13:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-03-15 13:40:19 UTC ---
Author: jakub
Date: Thu Mar 15 13:40:13 2012
New Revision: 185432

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=185432
Log:
    PR middle-end/52592
    * builtins.c (expand_builtin_int_roundingfn_2): If expanding
    BUILT_IN_IR{INT,OUND}* using optab fails, emit lr{int,ound}*
    calls instead of __builtin_ir{int,ound}*.

    * gcc.dg/pr52592.c: New test.

Added:
    branches/gcc-4_7-branch/gcc/testsuite/gcc.dg/pr52592.c
Modified:
    branches/gcc-4_7-branch/gcc/ChangeLog
    branches/gcc-4_7-branch/gcc/builtins.c
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog


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

* [Bug middle-end/52592] [4.7/4.8 Regression] compilation failure with undefined reference to `__builtin_iround'
  2012-03-15  5:40 [Bug c/52592] New: mplayer compilation failure with undefined reference to `__builtin_iround' ojab at ojab dot ru
                   ` (11 preceding siblings ...)
  2012-03-15 13:42 ` jakub at gcc dot gnu.org
@ 2012-03-15 14:18 ` jakub at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-03-15 14:18 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #13 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-03-15 13:42:41 UTC ---
Fixed.


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

end of thread, other threads:[~2012-03-15 13:42 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-15  5:40 [Bug c/52592] New: mplayer compilation failure with undefined reference to `__builtin_iround' ojab at ojab dot ru
2012-03-15  6:02 ` [Bug c/52592] " pinskia at gcc dot gnu.org
2012-03-15  6:04 ` [Bug middle-end/52592] " pinskia at gcc dot gnu.org
2012-03-15  6:04 ` ojab at ojab dot ru
2012-03-15  6:13 ` ojab at ojab dot ru
2012-03-15  6:13 ` [Bug middle-end/52592] [4.7/4.8 Regression] " pinskia at gcc dot gnu.org
2012-03-15  6:44 ` pinskia at gcc dot gnu.org
2012-03-15  7:11 ` pinskia at gcc dot gnu.org
2012-03-15  7:22 ` pinskia at gcc dot gnu.org
2012-03-15  7:47 ` pinskia at gcc dot gnu.org
2012-03-15  9:42 ` jakub at gcc dot gnu.org
2012-03-15 13:41 ` jakub at gcc dot gnu.org
2012-03-15 13:42 ` jakub at gcc dot gnu.org
2012-03-15 14:18 ` jakub 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).