From 2cfe523be931f26aa9988fa4d0b8ca57be548517 Mon Sep 17 00:00:00 2001
From: HongboLiu <lhbf@qq.com>
Date: Mon, 6 Jun 2022 16:49:32 +0800
Subject: [PATCH] [PATCH] c++ bugfix: inconsistent logic when have -O2

---
 gcc/gimple.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/gimple.cc b/gcc/gimple.cc
index b70ab4d..d9593aa 100644
--- a/gcc/gimple.cc
+++ b/gcc/gimple.cc
@@ -1566,6 +1566,9 @@ gimple_call_arg_flags (const gcall *stmt, unsigned arg)
   attr_fnspec fnspec = gimple_call_fnspec (stmt);
   int flags = 0;
 
+  if (!fnspec.known_p ())
+    return 0;
+
   if (fnspec.known_p ())
     flags = fnspec.arg_eaf_flags (arg);
   tree callee = gimple_call_fndecl (stmt);
-- 
2.7.4

