===================================================================
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-fPIC -O" } */
+/* { dg-final { scan-assembler-not "call" } } */
+
+void foo(void (*bar)(void))
+{
+ bar();
+}
===================================================================
@@ -5473,12 +5473,12 @@
rtx a, b;
/* If we are generating position-independent code, we cannot sibcall
- optimize any indirect call, or a direct call to a global function,
- as the PLT requires %ebx be live. (Darwin does not have a PLT.) */
+ optimize direct calls to global functions, as the PLT requires
+ %ebx be live. (Darwin does not have a PLT.) */
if (!TARGET_MACHO
&& !TARGET_64BIT
&& flag_pic
- && (!decl || !targetm.binds_local_p (decl)))
+ && decl && !targetm.binds_local_p (decl))
return false;