diff --git a/gcc/cgraphunit.cc b/gcc/cgraphunit.cc
index 01f4e28204e6f04d74b9d2b62e1763257f7eb2ec..bc3dc754481f6af51c685664753a0c83a935644d 100644
--- a/gcc/cgraphunit.cc
+++ b/gcc/cgraphunit.cc
@@ -621,6 +621,7 @@ cgraph_node::analyze (void)
   tree decl = this->decl;
   location_t saved_loc = input_location;
   input_location = DECL_SOURCE_LOCATION (decl);
+  semantic_interposition = opt_for_fn (decl, flag_semantic_interposition);
 
   if (thunk)
     {
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr103376.c b/gcc/testsuite/gcc.c-torture/compile/pr103376.c
new file mode 100644
index 0000000000000000000000000000000000000000..8c14c3ded38c9fc89b37b2bac2a6ff259304cc2d
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr103376.c
@@ -0,0 +1,9 @@
+/* { dg-additional-options "-Ofast" } */
+__attribute__ ((optimize ("no-associative-math"))) double
+fn3 (double h, double l)
+{
+  return h + l;
+}
+
+double fn3 (double, double) __attribute__ ((optimize ("O2,no-associative-math")));
+