[gcc r15-966] AVR: tree-optimization/115307 - Work around isinf bloat from early passes.

2024-06-01 Thread Georg-Johann Lay via Gcc-cvs
https://gcc.gnu.org/g:fabb545026f714b7d1cbe586f4c5bbf6430bdde3

commit r15-966-gfabb545026f714b7d1cbe586f4c5bbf6430bdde3
Author: Georg-Johann Lay 
Date:   Sat Jun 1 10:38:00 2024 +0200

AVR: tree-optimization/115307 - Work around isinf bloat from early passes.

PR tree-optimization/115307
gcc/
* config/avr/avr.md (SFDF): New mode iterator.
(isinf2) [sf, df]: New expanders.

gcc/testsuite/
* gcc.target/avr/torture/pr115307-isinf.c: New test.

Diff:
---
 gcc/config/avr/avr.md   | 16 
 .../gcc.target/avr/torture/pr115307-isinf.c | 21 +
 2 files changed, 37 insertions(+)

diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md
index d4fcff46123..75d35d5e14b 100644
--- a/gcc/config/avr/avr.md
+++ b/gcc/config/avr/avr.md
@@ -292,6 +292,8 @@
 (define_mode_iterator SPLIT34 [SI SF PSI
SQ USQ SA USA])
 
+(define_mode_iterator SFDF [SF DF])
+
 ;; Where the most significant bit is located.
 (define_mode_attr MSB  [(QI "7") (QQ "7") (UQQ "7")
 (HI "15") (HQ "15") (UHQ "15") (HA "15") (UHA "15")
@@ -10047,6 +10049,20 @@
  (const_int 1)
  (match_dup 2)))])
 
+
+;; Work around PR115307: Early passes expand isinf/f/l to a bloat.
+;; These passes do not consider costs, and there is no way to
+;; hook in or otherwise disable the generated bloat.
+
+;; isinfsf2  isinfdf2
+(define_expand "isinf2"
+  [(parallel [(match_operand:HI 0)
+  (match_operand:SFDF 1)])]
+  ""
+  {
+FAIL;
+  })
+
 
 ;; Fixed-point instructions
 (include "avr-fixed.md")
diff --git a/gcc/testsuite/gcc.target/avr/torture/pr115307-isinf.c 
b/gcc/testsuite/gcc.target/avr/torture/pr115307-isinf.c
new file mode 100644
index 000..6368bd205c5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/avr/torture/pr115307-isinf.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+
+int call_isinff (float f)
+{
+int isinff (float);
+return isinff (f);
+}
+
+int call_isinf (double f)
+{
+int isinf (double);
+return isinf (f);
+}
+
+int call_isinfl (long double f)
+{
+int isinfl (long double);
+return isinfl (f);
+}
+
+/* { dg-final { scan-assembler-not "unord" } } */


[gcc r14-10266] AVR: tree-optimization/115307 - Work around isinf bloat from early passes.

2024-06-01 Thread Georg-Johann Lay via Gcc-cvs
https://gcc.gnu.org/g:9d08c55f7c99329f4289ad3a4157c2d8d8a78d8c

commit r14-10266-g9d08c55f7c99329f4289ad3a4157c2d8d8a78d8c
Author: Georg-Johann Lay 
Date:   Sat Jun 1 10:38:00 2024 +0200

AVR: tree-optimization/115307 - Work around isinf bloat from early passes.

PR tree-optimization/115307
gcc/
* config/avr/avr.md (SFDF): New mode iterator.
(isinf2) [sf, df]: New expanders.

gcc/testsuite/
* gcc.target/avr/torture/pr115307-isinf.c: New test.

(cherry picked from commit fabb545026f714b7d1cbe586f4c5bbf6430bdde3)

Diff:
---
 gcc/config/avr/avr.md   | 16 
 .../gcc.target/avr/torture/pr115307-isinf.c | 21 +
 2 files changed, 37 insertions(+)

diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md
index d4fcff46123..75d35d5e14b 100644
--- a/gcc/config/avr/avr.md
+++ b/gcc/config/avr/avr.md
@@ -292,6 +292,8 @@
 (define_mode_iterator SPLIT34 [SI SF PSI
SQ USQ SA USA])
 
+(define_mode_iterator SFDF [SF DF])
+
 ;; Where the most significant bit is located.
 (define_mode_attr MSB  [(QI "7") (QQ "7") (UQQ "7")
 (HI "15") (HQ "15") (UHQ "15") (HA "15") (UHA "15")
@@ -10047,6 +10049,20 @@
  (const_int 1)
  (match_dup 2)))])
 
+
+;; Work around PR115307: Early passes expand isinf/f/l to a bloat.
+;; These passes do not consider costs, and there is no way to
+;; hook in or otherwise disable the generated bloat.
+
+;; isinfsf2  isinfdf2
+(define_expand "isinf2"
+  [(parallel [(match_operand:HI 0)
+  (match_operand:SFDF 1)])]
+  ""
+  {
+FAIL;
+  })
+
 
 ;; Fixed-point instructions
 (include "avr-fixed.md")
diff --git a/gcc/testsuite/gcc.target/avr/torture/pr115307-isinf.c 
b/gcc/testsuite/gcc.target/avr/torture/pr115307-isinf.c
new file mode 100644
index 000..6368bd205c5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/avr/torture/pr115307-isinf.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+
+int call_isinff (float f)
+{
+int isinff (float);
+return isinff (f);
+}
+
+int call_isinf (double f)
+{
+int isinf (double);
+return isinf (f);
+}
+
+int call_isinfl (long double f)
+{
+int isinfl (long double);
+return isinfl (f);
+}
+
+/* { dg-final { scan-assembler-not "unord" } } */


[gcc r15-967] libstdc++: Replace link to gcc-4.3.2 docs in manual [PR115269]

2024-06-01 Thread Jonathan Wakely via Libstdc++-cvs
https://gcc.gnu.org/g:b460ede64f9471589822831e04eecff4a3dbecf2

commit r15-967-gb460ede64f9471589822831e04eecff4a3dbecf2
Author: Jonathan Wakely 
Date:   Wed May 29 10:59:48 2024 +0100

libstdc++: Replace link to gcc-4.3.2 docs in manual [PR115269]

Link to the docs for GCC trunk instead. For the release branches, the
link should be to the docs for appropriate release branch.

Also replace the incomplete/outdated list of explicit -std options with
a single entry for the -std option.

libstdc++-v3/ChangeLog:

PR libstdc++/115269
* doc/xml/manual/using.xml: Replace link to gcc-4.3.2 docs.
Replace list of -std=... options with a single entry for -std.
* doc/html/manual/using.html: Regenerate.

Diff:
---
 libstdc++-v3/doc/html/manual/using.html | 10 ++
 libstdc++-v3/doc/xml/manual/using.xml   | 33 +
 2 files changed, 11 insertions(+), 32 deletions(-)

diff --git a/libstdc++-v3/doc/html/manual/using.html 
b/libstdc++-v3/doc/html/manual/using.html
index d663660b3a4..fcd1b96de0d 100644
--- a/libstdc++-v3/doc/html/manual/using.html
+++ b/libstdc++-v3/doc/html/manual/using.html
@@ -4,7 +4,7 @@
   
  NextChapter 3. UsingTable of ContentsCommand 
OptionsHeadersHeader 
FilesMixing 
HeadersThe C Headers and 
namespace stdPrecompiled HeadersMacrosDual 
ABITroubleshootingNamespacesAvailable 
Namespacesnamespace 
stdUsing Namespace 
CompositionLinkingAlmost NothingFinding 
Dynamic or Shared LibrariesExperimental
 Library ExtensionsConcurrencyPrerequisitesThread
 SafetyAtomicsIOStructureDefaultsFutureAlternativesContainersExceptionsException 
SafetyException 
NeutralityMemory allocation<
 /span>Doing 
withoutCompatibilityWith 
CWith POSIX thread 
cancellationDebugging SupportUsing g++Debug 
ModeTracking uncaught 
exceptionsMemory Leak 
HuntingNon-memory leaks in Pool and MT 
allocatorsData Race HuntingUsing gdbDebug Versions of Library Binary 
FilesCompile Time 
CheckingCommand Options
   The set of features available in the GNU C++ library is shaped by
-  several http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Invoking-GCC.html"; 
target="_top">GCC
+  several https://gcc.gnu.org/onlinedocs/gcc/Invoking-GCC.html"; target="_top">GCC
   Command Options. Options that impact libstdc++ are
   enumerated and detailed in the table below.
 
@@ -14,9 +14,11 @@
   g++ -std=gnu++17 since GCC 
11, and
   g++ -std=gnu++14 in GCC 6, 
7, 8, 9, and 10, and
   g++ -std=gnu++98 for older 
releases.
-Table 3.1. C++ Command OptionsOption FlagsDescription-std=c++98 or -std=c++03
-  Use the 1998 ISO C++ standard plus 
amendments.-std=gnu++98 or -std=gnu++03
-  As directly above, with GNU 
extensions.-std=c++11Use the 2011 ISO C++ 
standard.-std=gnu++11As directly above, 
with GNU extensions.-std=c++14Use the 2014 ISO C++ 
standard.-std=gnu++14As directly above, 
with GNU extensions.
+Table 3.1. C++ Command OptionsOption FlagsDescription-std
+  
+   Select the C++ standard, and whether to use the base standard
+   or GNU dialect.
+  
-fno-exceptions
   See exception-free dialect
-fno-rtti
diff --git a/libstdc++-v3/doc/xml/manual/using.xml 
b/libstdc++-v3/doc/xml/manual/using.xml
index 8ac7e74034c..74321733e8f 100644
--- a/libstdc++-v3/doc/xml/manual/using.xml
+++ b/libstdc++-v3/doc/xml/manual/using.xml
@@ -7,7 +7,7 @@
 
 
   The set of features available in the GNU C++ library is shaped by
-  several http://www.w3.org/1999/xlink"; 
xlink:href="http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Invoking-GCC.html";>GCC
+  several http://www.w3.org/1999/xlink"; 
xlink:href="https://gcc.gnu.org/onlinedocs/gcc/Invoking-GCC.html";>GCC
   Command Options. Options that impact libstdc++ are
   enumerated and detailed in the table below.
 
@@ -37,35 +37,12 @@
 
   
 
-  -std=c++98 or -std=c++03
+  -std
   
-  Use the 1998 ISO C++ standard plus amendments.
-
-
-
-  -std=gnu++98 or -std=gnu++03
+  
+   Select the C++ standard, and whether to use the base standard
+   or GNU dialect.
   
-  As directly above, with GNU extensions.
-
-
-
-  -std=c++11
-  Use the 2011 ISO C++ standard.
-
-
-
-  -std=gnu++11
-  As directly above, with GNU extensions.
-
-
-
-  -std=c++14
-  Use the 2014 ISO C++ standard.
-
-
-
-  -std=gnu++14
-  As directly above, with GNU extensions.
 
 
 


[gcc r14-10267] libstdc++: Replace link to gcc-4.3.2 docs in manual [PR115269]

2024-06-01 Thread Jonathan Wakely via Libstdc++-cvs
https://gcc.gnu.org/g:2f097c0b3f76b50d96895158b2d80024252cfbd0

commit r14-10267-g2f097c0b3f76b50d96895158b2d80024252cfbd0
Author: Jonathan Wakely 
Date:   Wed May 29 10:59:48 2024 +0100

libstdc++: Replace link to gcc-4.3.2 docs in manual [PR115269]

Link to the docs for GCC trunk instead. For the release branches, the
link should be to the docs for appropriate release branch.

Also replace the incomplete/outdated list of explicit -std options with
a single entry for the -std option.

libstdc++-v3/ChangeLog:

PR libstdc++/115269
* doc/xml/manual/using.xml: Replace link to gcc-4.3.2 docs.
Replace list of -std=... options with a single entry for -std.
* doc/html/manual/using.html: Regenerate.

(cherry picked from commit b460ede64f9471589822831e04eecff4a3dbecf2)

Diff:
---
 libstdc++-v3/doc/html/manual/using.html | 10 ++
 libstdc++-v3/doc/xml/manual/using.xml   | 33 +
 2 files changed, 11 insertions(+), 32 deletions(-)

diff --git a/libstdc++-v3/doc/html/manual/using.html 
b/libstdc++-v3/doc/html/manual/using.html
index d663660b3a4..e35f1e8e392 100644
--- a/libstdc++-v3/doc/html/manual/using.html
+++ b/libstdc++-v3/doc/html/manual/using.html
@@ -4,7 +4,7 @@
   
  NextChapter 3. UsingTable of ContentsCommand 
OptionsHeadersHeader 
FilesMixing 
HeadersThe C Headers and 
namespace stdPrecompiled HeadersMacrosDual 
ABITroubleshootingNamespacesAvailable 
Namespacesnamespace 
stdUsing Namespace 
CompositionLinkingAlmost NothingFinding 
Dynamic or Shared LibrariesExperimental
 Library ExtensionsConcurrencyPrerequisitesThread
 SafetyAtomicsIOStructureDefaultsFutureAlternativesContainersExceptionsException 
SafetyException 
NeutralityMemory allocation<
 /span>Doing 
withoutCompatibilityWith 
CWith POSIX thread 
cancellationDebugging SupportUsing g++Debug 
ModeTracking uncaught 
exceptionsMemory Leak 
HuntingNon-memory leaks in Pool and MT 
allocatorsData Race HuntingUsing gdbDebug Versions of Library Binary 
FilesCompile Time 
CheckingCommand Options
   The set of features available in the GNU C++ library is shaped by
-  several http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Invoking-GCC.html"; 
target="_top">GCC
+  several https://gcc.gnu.org/onlinedocs/gcc-14.1.0/gcc/Invoking-GCC.html"; 
target="_top">GCC
   Command Options. Options that impact libstdc++ are
   enumerated and detailed in the table below.
 
@@ -14,9 +14,11 @@
   g++ -std=gnu++17 since GCC 
11, and
   g++ -std=gnu++14 in GCC 6, 
7, 8, 9, and 10, and
   g++ -std=gnu++98 for older 
releases.
-Table 3.1. C++ Command OptionsOption FlagsDescription-std=c++98 or -std=c++03
-  Use the 1998 ISO C++ standard plus 
amendments.-std=gnu++98 or -std=gnu++03
-  As directly above, with GNU 
extensions.-std=c++11Use the 2011 ISO C++ 
standard.-std=gnu++11As directly above, 
with GNU extensions.-std=c++14Use the 2014 ISO C++ 
standard.-std=gnu++14As directly above, 
with GNU extensions.
+Table 3.1. C++ Command OptionsOption FlagsDescription-std
+  
+   Select the C++ standard, and whether to use the base standard
+   or GNU dialect.
+  
-fno-exceptions
   See exception-free dialect
-fno-rtti
diff --git a/libstdc++-v3/doc/xml/manual/using.xml 
b/libstdc++-v3/doc/xml/manual/using.xml
index 8ac7e74034c..2baa9920517 100644
--- a/libstdc++-v3/doc/xml/manual/using.xml
+++ b/libstdc++-v3/doc/xml/manual/using.xml
@@ -7,7 +7,7 @@
 
 
   The set of features available in the GNU C++ library is shaped by
-  several http://www.w3.org/1999/xlink"; 
xlink:href="http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Invoking-GCC.html";>GCC
+  several http://www.w3.org/1999/xlink"; 
xlink:href="https://gcc.gnu.org/onlinedocs/gcc-14.1.0/gcc/Invoking-GCC.html";>GCC
   Command Options. Options that impact libstdc++ are
   enumerated and detailed in the table below.
 
@@ -37,35 +37,12 @@
 
   
 
-  -std=c++98 or -std=c++03
+  -std
   
-  Use the 1998 ISO C++ standard plus amendments.
-
-
-
-  -std=gnu++98 or -std=gnu++03
+  
+   Select the C++ standard, and whether to use the base standard
+   or GNU dialect.
   
-  As directly above, with GNU extensions.
-
-
-
-  -std=c++11
-  Use the 2011 ISO C++ standard.
-
-
-
-  -std=gnu++11
-  As directly above, with GNU extensions.
-
-
-
-  -std=c++14
-  Use the 2014 ISO C++ standard.
-
-
-
-  -std=gnu++14
-  As directly above, with GNU extensions.
 
 
 


[gcc r13-8815] libstdc++: Replace link to gcc-4.3.2 docs in manual [PR115269]

2024-06-01 Thread Jonathan Wakely via Gcc-cvs
https://gcc.gnu.org/g:3687dcfabfaae566f4b42aa8a805869b809e6247

commit r13-8815-g3687dcfabfaae566f4b42aa8a805869b809e6247
Author: Jonathan Wakely 
Date:   Wed May 29 10:59:48 2024 +0100

libstdc++: Replace link to gcc-4.3.2 docs in manual [PR115269]

Link to the docs for GCC trunk instead. For the release branches, the
link should be to the docs for appropriate release branch.

Also replace the incomplete/outdated list of explicit -std options with
a single entry for the -std option.

libstdc++-v3/ChangeLog:

PR libstdc++/115269
* doc/xml/manual/using.xml: Replace link to gcc-4.3.2 docs.
Replace list of -std=... options with a single entry for -std.
* doc/html/manual/using.html: Regenerate.

(cherry picked from commit b460ede64f9471589822831e04eecff4a3dbecf2)

Diff:
---
 libstdc++-v3/doc/html/manual/using.html | 10 ++
 libstdc++-v3/doc/xml/manual/using.xml   | 33 +
 2 files changed, 11 insertions(+), 32 deletions(-)

diff --git a/libstdc++-v3/doc/html/manual/using.html 
b/libstdc++-v3/doc/html/manual/using.html
index e8e0c6c0e85..144ca80e030 100644
--- a/libstdc++-v3/doc/html/manual/using.html
+++ b/libstdc++-v3/doc/html/manual/using.html
@@ -4,7 +4,7 @@
   
  NextChapter 3. UsingTable of ContentsCommand 
OptionsHeadersHeader 
FilesMixing 
HeadersThe C Headers and 
namespace stdPrecompiled HeadersMacrosDual 
ABITroubleshootingNamespacesAvailable 
Namespacesnamespace 
stdUsing Namespace 
CompositionLinkingAlmost NothingFinding 
Dynamic or Shared LibrariesExperimental
 Library ExtensionsConcurrencyPrerequisitesThread
 SafetyAtomicsIOStructureDefaultsFutureAlternativesContainersExceptionsException 
SafetyException 
NeutralityMemory allocation<
 /span>Doing 
withoutCompatibilityWith 
CWith POSIX thread 
cancellationDebugging SupportUsing g++Debug Versions of Library Binary 
FilesMemory Leak Huntinghref="debug.html#debug.memory.mtalloc">Non-memory leaks in Pool and MT 
 >allocatorshref="debug.html#debug.races">Data Race Huntingclass="section">Using class="command">gdbclass="section">Tracking uncaught 
 >exceptionshref="debug.html#debug.debug_mode">Debug Modeclass="section">Compile Time 
 >Checkingclass="titlepage">id="manual.intro.using.flags">Command Options
   The set of features available in the GNU C++ library is shaped by
-  several http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Invoking-GCC.html"; 
target="_top">GCC
+  several https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Invoking-GCC.html"; 
target="_top">GCC
   Command Options. Options that impact libstdc++ are
   enumerated and detailed in the table below.
 
@@ -14,9 +14,11 @@
   g++ -std=gnu++17 since GCC 
11, and
   g++ -std=gnu++14 in GCC 6, 
7, 8, 9, and 10, and
   g++ -std=gnu++98 for older 
releases.
-Table 3.1. C++ Command OptionsOption FlagsDescription-std=c++98 or -std=c++03
-  Use the 1998 ISO C++ standard plus 
amendments.-std=gnu++98 or -std=gnu++03
-  As directly above, with GNU 
extensions.-std=c++11Use the 2011 ISO C++ 
standard.-std=gnu++11As directly above, 
with GNU extensions.-std=c++14Use the 2014 ISO C++ 
standard.-std=gnu++14As directly above, 
with GNU extensions.
+Table 3.1. C++ Command OptionsOption FlagsDescription-std
+  
+   Select the C++ standard, and whether to use the base standard
+   or GNU dialect.
+  
-fno-exceptions
   See exception-free dialect
-fno-rtti
diff --git a/libstdc++-v3/doc/xml/manual/using.xml 
b/libstdc++-v3/doc/xml/manual/using.xml
index 7276cad0feb..42890f3b180 100644
--- a/libstdc++-v3/doc/xml/manual/using.xml
+++ b/libstdc++-v3/doc/xml/manual/using.xml
@@ -7,7 +7,7 @@
 
 
   The set of features available in the GNU C++ library is shaped by
-  several http://www.w3.org/1999/xlink"; 
xlink:href="http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Invoking-GCC.html";>GCC
+  several http://www.w3.org/1999/xlink"; 
xlink:href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Invoking-GCC.html";>GCC
   Command Options. Options that impact libstdc++ are
   enumerated and detailed in the table below.
 
@@ -37,35 +37,12 @@
 
   
 
-  -std=c++98 or -std=c++03
+  -std
   
-  Use the 1998 ISO C++ standard plus amendments.
-
-
-
-  -std=gnu++98 or -std=gnu++03
+  
+   Select the C++ standard, and whether to use the base standard
+   or GNU dialect.
   
-  As directly above, with GNU extensions.
-
-
-
-  -std=c++11
-  Use the 2011 ISO C++ standard.
-
-
-
-  -std=gnu++11
-  As directly above, with GNU extensions.
-
-
-
-  -std=c++14
-  Use the 2014 ISO C++ standard.
-
-
-
-  -std=gnu++14
-  As directly above, with GNU extensions.
 
 
 


[gcc r12-10483] libstdc++: Replace link to gcc-4.3.2 docs in manual [PR115269]

2024-06-01 Thread Jonathan Wakely via Libstdc++-cvs
https://gcc.gnu.org/g:26fa081ad4b7299a33b5ff4525bce8858a1b0dd2

commit r12-10483-g26fa081ad4b7299a33b5ff4525bce8858a1b0dd2
Author: Jonathan Wakely 
Date:   Wed May 29 10:59:48 2024 +0100

libstdc++: Replace link to gcc-4.3.2 docs in manual [PR115269]

Link to the docs for GCC trunk instead. For the release branches, the
link should be to the docs for appropriate release branch.

Also replace the incomplete/outdated list of explicit -std options with
a single entry for the -std option.

libstdc++-v3/ChangeLog:

PR libstdc++/115269
* doc/xml/manual/using.xml: Replace link to gcc-4.3.2 docs.
Replace list of -std=... options with a single entry for -std.
* doc/html/manual/using.html: Regenerate.

(cherry picked from commit b460ede64f9471589822831e04eecff4a3dbecf2)

Diff:
---
 libstdc++-v3/doc/html/manual/using.html | 10 ++
 libstdc++-v3/doc/xml/manual/using.xml   | 33 +
 2 files changed, 11 insertions(+), 32 deletions(-)

diff --git a/libstdc++-v3/doc/html/manual/using.html 
b/libstdc++-v3/doc/html/manual/using.html
index 08facffa445..b93fed02fc4 100644
--- a/libstdc++-v3/doc/html/manual/using.html
+++ b/libstdc++-v3/doc/html/manual/using.html
@@ -4,7 +4,7 @@
   
  NextChapter 3. UsingTable of ContentsCommand 
OptionsHeadersHeader 
FilesMixing 
HeadersThe C Headers and 
namespace stdPrecompiled HeadersMacrosDual 
ABITroubleshootingNamespacesAvailable 
Namespacesnamespace 
stdUsing Namespace 
CompositionLinkingAlmost NothingFinding 
Dynamic or Shared LibrariesExperimental
 Library ExtensionsConcurrencyPrerequisitesThread
 SafetyAtomicsIOStructureDefaultsFutureAlternativesContainersExceptionsException 
SafetyException 
NeutralityDoing without<
 /dt>CompatibilityWith 
CWith POSIX thread 
cancellationDebugging SupportUsing g++Debug Versions of Library Binary 
FilesMemory Leak 
HuntingNon-memory leaks in Pool and MT 
allocatorsData Race HuntingUsing gdbTracking uncaught 
exceptionsDebug ModeCompile Time 
CheckingCommand Options
   The set of features available in the GNU C++ library is shaped by
-  several http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Invoking-GCC.html"; 
target="_top">GCC
+  several https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gcc/Invoking-GCC.html"; 
target="_top">GCC
   Command Options. Options that impact libstdc++ are
   enumerated and detailed in the table below.
 
@@ -14,9 +14,11 @@
   g++ -std=gnu++17 since GCC 
11, and
   g++ -std=gnu++14 in GCC 6, 
7, 8, 9, and 10, and
   g++ -std=gnu++98 for older 
releases.
-Table 3.1. C++ Command OptionsOption FlagsDescription-std=c++98 or -std=c++03
-  Use the 1998 ISO C++ standard plus 
amendments.-std=gnu++98 or -std=gnu++03
-  As directly above, with GNU 
extensions.-std=c++11Use the 2011 ISO C++ 
standard.-std=gnu++11As directly above, 
with GNU extensions.-std=c++14Use the 2014 ISO C++ 
standard.-std=gnu++14As directly above, 
with GNU extensions.
+Table 3.1. C++ Command OptionsOption FlagsDescription-std
+  
+   Select the C++ standard, and whether to use the base standard
+   or GNU dialect.
+  
-fno-exceptions
   See exception-free dialect
-fno-rtti
diff --git a/libstdc++-v3/doc/xml/manual/using.xml 
b/libstdc++-v3/doc/xml/manual/using.xml
index a8a549eebcd..1c075084a56 100644
--- a/libstdc++-v3/doc/xml/manual/using.xml
+++ b/libstdc++-v3/doc/xml/manual/using.xml
@@ -7,7 +7,7 @@
 
 
   The set of features available in the GNU C++ library is shaped by
-  several http://www.w3.org/1999/xlink"; 
xlink:href="http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Invoking-GCC.html";>GCC
+  several http://www.w3.org/1999/xlink"; 
xlink:href="https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gcc/Invoking-GCC.html";>GCC
   Command Options. Options that impact libstdc++ are
   enumerated and detailed in the table below.
 
@@ -37,35 +37,12 @@
 
   
 
-  -std=c++98 or -std=c++03
+  -std
   
-  Use the 1998 ISO C++ standard plus amendments.
-
-
-
-  -std=gnu++98 or -std=gnu++03
+  
+   Select the C++ standard, and whether to use the base standard
+   or GNU dialect.
   
-  As directly above, with GNU extensions.
-
-
-
-  -std=c++11
-  Use the 2011 ISO C++ standard.
-
-
-
-  -std=gnu++11
-  As directly above, with GNU extensions.
-
-
-
-  -std=c++14
-  Use the 2014 ISO C++ standard.
-
-
-
-  -std=gnu++14
-  As directly above, with GNU extensions.
 
 
 


[gcc r11-11460] libstdc++: Replace link to gcc-4.3.2 docs in manual [PR115269]

2024-06-01 Thread Jonathan Wakely via Libstdc++-cvs
https://gcc.gnu.org/g:9b792e0159f7076e5901972be751333006e2ea83

commit r11-11460-g9b792e0159f7076e5901972be751333006e2ea83
Author: Jonathan Wakely 
Date:   Wed May 29 10:59:48 2024 +0100

libstdc++: Replace link to gcc-4.3.2 docs in manual [PR115269]

Link to the docs for GCC trunk instead. For the release branches, the
link should be to the docs for appropriate release branch.

Also replace the incomplete/outdated list of explicit -std options with
a single entry for the -std option.

libstdc++-v3/ChangeLog:

PR libstdc++/115269
* doc/xml/manual/using.xml: Replace link to gcc-4.3.2 docs.
Replace list of -std=... options with a single entry for -std.
* doc/html/manual/using.html: Regenerate.

(cherry picked from commit b460ede64f9471589822831e04eecff4a3dbecf2)

Diff:
---
 libstdc++-v3/doc/html/manual/using.html | 10 ++
 libstdc++-v3/doc/xml/manual/using.xml   | 33 +
 2 files changed, 11 insertions(+), 32 deletions(-)

diff --git a/libstdc++-v3/doc/html/manual/using.html 
b/libstdc++-v3/doc/html/manual/using.html
index 641a08c688b..c0d7535d332 100644
--- a/libstdc++-v3/doc/html/manual/using.html
+++ b/libstdc++-v3/doc/html/manual/using.html
@@ -4,7 +4,7 @@
   
  NextChapter 3. UsingTable of ContentsCommand 
OptionsHeadersHeader 
FilesMixing 
HeadersThe C Headers and 
namespace stdPrecompiled HeadersMacrosDual 
ABITroubleshootingNamespacesAvailable 
Namespacesnamespace 
stdUsing Namespace 
CompositionLinkingAlmost NothingFinding 
Dynamic or Shared LibrariesExperimental
 Library ExtensionsConcurrencyPrerequisitesThread
 SafetyAtomicsIOStructureDefaultsFutureAlternativesContainersExceptionsException 
SafetyException 
NeutralityDoing without<
 /dt>CompatibilityWith 
CWith POSIX thread 
cancellationDebugging SupportUsing g++Debug Versions of Library Binary 
FilesMemory Leak 
HuntingNon-memory leaks in Pool and MT 
allocatorsData Race HuntingUsing gdbTracking uncaught 
exceptionsDebug ModeCompile Time 
CheckingCommand Options
   The set of features available in the GNU C++ library is shaped by
-  several http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Invoking-GCC.html"; 
target="_top">GCC
+  several https://gcc.gnu.org/onlinedocs/gcc-11.1.0/gcc/Invoking-GCC.html"; 
target="_top">GCC
   Command Options. Options that impact libstdc++ are
   enumerated and detailed in the table below.
 
@@ -14,9 +14,11 @@
   g++ -std=gnu++17 since GCC 
11, and
   g++ -std=gnu++14 in GCC 6, 
7, 8, 9, and 10, and
   g++ -std=gnu++98 for older 
releases.
-Table 3.1. C++ Command OptionsOption FlagsDescription-std=c++98 or -std=c++03
-  Use the 1998 ISO C++ standard plus 
amendments.-std=gnu++98 or -std=gnu++03
-  As directly above, with GNU 
extensions.-std=c++11Use the 2011 ISO C++ 
standard.-std=gnu++11As directly above, 
with GNU extensions.-std=c++14Use the 2014 ISO C++ 
standard.-std=gnu++14As directly above, 
with GNU extensions.-fexceptionsSee exception-free dialect-frttiAs above, but RTTI-free 
dialect.-pthreadFor ISO C++11
+Table 3.1. C++ Command OptionsOption FlagsDescription-std
+  
+   Select the C++ standard, and whether to use the base standard
+   or GNU dialect.
+  -fexceptionsSee exception-free dialect-frttiAs above, but RTTI-free 
dialect.-pthreadFor ISO C++11
 ,
 ,
 ,
diff --git a/libstdc++-v3/doc/xml/manual/using.xml 
b/libstdc++-v3/doc/xml/manual/using.xml
index ff22e509aa8..656943c39e3 100644
--- a/libstdc++-v3/doc/xml/manual/using.xml
+++ b/libstdc++-v3/doc/xml/manual/using.xml
@@ -7,7 +7,7 @@
 
 
   The set of features available in the GNU C++ library is shaped by
-  several http://www.w3.org/1999/xlink"; 
xlink:href="http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Invoking-GCC.html";>GCC
+  several http://www.w3.org/1999/xlink"; 
xlink:href="https://gcc.gnu.org/onlinedocs/gcc-11.1.0/gcc/Invoking-GCC.html";>GCC
   Command Options. Options that impact libstdc++ are
   enumerated and detailed in the table below.
 
@@ -37,35 +37,12 @@
 
   
 
-  -std=c++98 or -std=c++03
+  -std
   
-  Use the 1998 ISO C++ standard plus amendments.
-
-
-
-  -std=gnu++98 or -std=gnu++03
+  
+   Select the C++ standard, and whether to use the base standard
+   or GNU dialect.
   
-  As directly above, with GNU extensions.
-
-
-
-  -std=c++11
-  Use the 2011 ISO C++ standard.
-
-
-
-  -std=gnu++11
-  As directly above, with GNU extensions.
-
-
-
-  -std=c++14
-  Use the 2014 ISO C++ standard.
-
-
-
-  -std=gnu++14
-  As directly above, with GNU extensions.
 
 
 


[gcc r15-968] AVR: target/115317 - Make isinf(-Inf) return -1.

2024-06-01 Thread Georg-Johann Lay via Gcc-cvs
https://gcc.gnu.org/g:f12454278dc725fec3520a5d870e967d79292ee6

commit r15-968-gf12454278dc725fec3520a5d870e967d79292ee6
Author: Georg-Johann Lay 
Date:   Sat Jun 1 12:46:31 2024 +0200

AVR: target/115317 - Make isinf(-Inf) return -1.

PR target/115317
libgcc/config/avr/libf7/
* libf7-asm.sx (__isinf): Map -Inf to -1.

gcc/testsuite/
* gcc.target/avr/torture/pr115317-isinf.c: New test.

Diff:
---
 .../gcc.target/avr/torture/pr115317-isinf.c| 55 ++
 libgcc/config/avr/libf7/libf7-asm.sx   | 19 +---
 2 files changed, 67 insertions(+), 7 deletions(-)

diff --git a/gcc/testsuite/gcc.target/avr/torture/pr115317-isinf.c 
b/gcc/testsuite/gcc.target/avr/torture/pr115317-isinf.c
new file mode 100644
index 000..10f7b553fb9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/avr/torture/pr115317-isinf.c
@@ -0,0 +1,55 @@
+/* { dg-do run { target { ! avr_tiny } } } */
+
+extern int isinff (float);
+extern int isinf (double);
+extern int isinfl (long double);
+
+int tst_isinf (float x, int val)
+{
+  double y;
+  long double z;
+
+  __asm ("" : "+r"(x));
+  if (isinff (x) != val)
+__builtin_exit (__LINE__);
+
+  y = x;
+  __asm ("" : "+r"(y));
+  if (isinf (y) != val)
+  __builtin_exit (__LINE__);
+
+  z = x;
+  __asm ("" : "+r"(z));
+  if (isinfl (z) != val)
+  __builtin_exit (__LINE__);
+}
+
+static float make_f (__UINT32_TYPE__ i)
+{
+  float f;
+  __builtin_memcpy (&f, &i, 4);
+  return f;
+}
+
+int main (void)
+{
+  tst_isinf (__builtin_huge_valf(), 1);
+  tst_isinf (-__builtin_huge_valf(), -1);
+  tst_isinf (__builtin_nanf(""), 0);
+  tst_isinf (0.0f, 0);
+  tst_isinf (-0.0f, 0);
+  tst_isinf (1.0f, 0);
+  tst_isinf (-1.0f, 0);
+  tst_isinf (make_f (0x7f80), 1);
+  tst_isinf (make_f (0xff80), -1);
+  tst_isinf (make_f (0x7f7f), 0);
+  tst_isinf (make_f (0xff7f), 0);
+  tst_isinf (make_f (0x7f81), 0);
+  tst_isinf (make_f (0xff81), 0);
+  tst_isinf (make_f (0x0080), 0);
+  tst_isinf (make_f (0x8080), 0);
+  tst_isinf (make_f (0x0040), 0);
+  tst_isinf (make_f (0x8040), 0);
+  
+  return 0;
+}
diff --git a/libgcc/config/avr/libf7/libf7-asm.sx 
b/libgcc/config/avr/libf7/libf7-asm.sx
index 1f8f60ab282..bef62f3a46a 100644
--- a/libgcc/config/avr/libf7/libf7-asm.sx
+++ b/libgcc/config/avr/libf7/libf7-asm.sx
@@ -1639,19 +1639,24 @@ _ENDF __copysign
 
 
 #ifdef F7MOD_D_isinf_
+;;; +Inf  ->  +1
+;;; -Inf  ->  -1
 _DEFUN __isinf
 DALIAS isinf
 LALIAS isinfl
+;; Save sign for later
+pushR25
 F7call  class_D
+pop TMP
+ldi R24,0
+ldi R25,0
 ;; Inf: T = Z = 1.
-brtc 0f
+brtc 0f ; ordinary number
+brne 0f ; Nan
 ldi R24,1
-breq 1f
-0:
-clr R24
-1:
-clr R25
-ret
+sbrcTMP,7
+sbiwR24,2
+0:  ret
 _ENDF __isinf
 #endif /* F7MOD_D_isinf_ */


[gcc r14-10268] AVR: target/115317 - Make isinf(-Inf) return -1.

2024-06-01 Thread Georg-Johann Lay via Gcc-cvs
https://gcc.gnu.org/g:d7f42794d94e5a26f396253b1698ea1930337df3

commit r14-10268-gd7f42794d94e5a26f396253b1698ea1930337df3
Author: Georg-Johann Lay 
Date:   Sat Jun 1 12:46:31 2024 +0200

AVR: target/115317 - Make isinf(-Inf) return -1.

PR target/115317
libgcc/config/avr/libf7/
* libf7-asm.sx (__isinf): Map -Inf to -1.

gcc/testsuite/
* gcc.target/avr/torture/pr115317-isinf.c: New test.

(cherry picked from commit f12454278dc725fec3520a5d870e967d79292ee6)

Diff:
---
 .../gcc.target/avr/torture/pr115317-isinf.c| 55 ++
 libgcc/config/avr/libf7/libf7-asm.sx   | 19 +---
 2 files changed, 67 insertions(+), 7 deletions(-)

diff --git a/gcc/testsuite/gcc.target/avr/torture/pr115317-isinf.c 
b/gcc/testsuite/gcc.target/avr/torture/pr115317-isinf.c
new file mode 100644
index 000..10f7b553fb9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/avr/torture/pr115317-isinf.c
@@ -0,0 +1,55 @@
+/* { dg-do run { target { ! avr_tiny } } } */
+
+extern int isinff (float);
+extern int isinf (double);
+extern int isinfl (long double);
+
+int tst_isinf (float x, int val)
+{
+  double y;
+  long double z;
+
+  __asm ("" : "+r"(x));
+  if (isinff (x) != val)
+__builtin_exit (__LINE__);
+
+  y = x;
+  __asm ("" : "+r"(y));
+  if (isinf (y) != val)
+  __builtin_exit (__LINE__);
+
+  z = x;
+  __asm ("" : "+r"(z));
+  if (isinfl (z) != val)
+  __builtin_exit (__LINE__);
+}
+
+static float make_f (__UINT32_TYPE__ i)
+{
+  float f;
+  __builtin_memcpy (&f, &i, 4);
+  return f;
+}
+
+int main (void)
+{
+  tst_isinf (__builtin_huge_valf(), 1);
+  tst_isinf (-__builtin_huge_valf(), -1);
+  tst_isinf (__builtin_nanf(""), 0);
+  tst_isinf (0.0f, 0);
+  tst_isinf (-0.0f, 0);
+  tst_isinf (1.0f, 0);
+  tst_isinf (-1.0f, 0);
+  tst_isinf (make_f (0x7f80), 1);
+  tst_isinf (make_f (0xff80), -1);
+  tst_isinf (make_f (0x7f7f), 0);
+  tst_isinf (make_f (0xff7f), 0);
+  tst_isinf (make_f (0x7f81), 0);
+  tst_isinf (make_f (0xff81), 0);
+  tst_isinf (make_f (0x0080), 0);
+  tst_isinf (make_f (0x8080), 0);
+  tst_isinf (make_f (0x0040), 0);
+  tst_isinf (make_f (0x8040), 0);
+  
+  return 0;
+}
diff --git a/libgcc/config/avr/libf7/libf7-asm.sx 
b/libgcc/config/avr/libf7/libf7-asm.sx
index 1f8f60ab282..bef62f3a46a 100644
--- a/libgcc/config/avr/libf7/libf7-asm.sx
+++ b/libgcc/config/avr/libf7/libf7-asm.sx
@@ -1639,19 +1639,24 @@ _ENDF __copysign
 
 
 #ifdef F7MOD_D_isinf_
+;;; +Inf  ->  +1
+;;; -Inf  ->  -1
 _DEFUN __isinf
 DALIAS isinf
 LALIAS isinfl
+;; Save sign for later
+pushR25
 F7call  class_D
+pop TMP
+ldi R24,0
+ldi R25,0
 ;; Inf: T = Z = 1.
-brtc 0f
+brtc 0f ; ordinary number
+brne 0f ; Nan
 ldi R24,1
-breq 1f
-0:
-clr R24
-1:
-clr R25
-ret
+sbrcTMP,7
+sbiwR24,2
+0:  ret
 _ENDF __isinf
 #endif /* F7MOD_D_isinf_ */


[gcc r13-8816] AVR: target/115317 - Make isinf(-Inf) return -1.

2024-06-01 Thread Georg-Johann Lay via Gcc-cvs
https://gcc.gnu.org/g:b45d7281c1b4eb2cf61280b9f7064229b7ca7581

commit r13-8816-gb45d7281c1b4eb2cf61280b9f7064229b7ca7581
Author: Georg-Johann Lay 
Date:   Sat Jun 1 12:46:31 2024 +0200

AVR: target/115317 - Make isinf(-Inf) return -1.

PR target/115317
libgcc/config/avr/libf7/
* libf7-asm.sx (__isinf): Map -Inf to -1.

gcc/testsuite/
* gcc.target/avr/torture/pr115317-isinf.c: New test.

(cherry picked from commit f12454278dc725fec3520a5d870e967d79292ee6)

Diff:
---
 .../gcc.target/avr/torture/pr115317-isinf.c| 55 ++
 libgcc/config/avr/libf7/libf7-asm.sx   | 19 +---
 2 files changed, 67 insertions(+), 7 deletions(-)

diff --git a/gcc/testsuite/gcc.target/avr/torture/pr115317-isinf.c 
b/gcc/testsuite/gcc.target/avr/torture/pr115317-isinf.c
new file mode 100644
index 000..10f7b553fb9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/avr/torture/pr115317-isinf.c
@@ -0,0 +1,55 @@
+/* { dg-do run { target { ! avr_tiny } } } */
+
+extern int isinff (float);
+extern int isinf (double);
+extern int isinfl (long double);
+
+int tst_isinf (float x, int val)
+{
+  double y;
+  long double z;
+
+  __asm ("" : "+r"(x));
+  if (isinff (x) != val)
+__builtin_exit (__LINE__);
+
+  y = x;
+  __asm ("" : "+r"(y));
+  if (isinf (y) != val)
+  __builtin_exit (__LINE__);
+
+  z = x;
+  __asm ("" : "+r"(z));
+  if (isinfl (z) != val)
+  __builtin_exit (__LINE__);
+}
+
+static float make_f (__UINT32_TYPE__ i)
+{
+  float f;
+  __builtin_memcpy (&f, &i, 4);
+  return f;
+}
+
+int main (void)
+{
+  tst_isinf (__builtin_huge_valf(), 1);
+  tst_isinf (-__builtin_huge_valf(), -1);
+  tst_isinf (__builtin_nanf(""), 0);
+  tst_isinf (0.0f, 0);
+  tst_isinf (-0.0f, 0);
+  tst_isinf (1.0f, 0);
+  tst_isinf (-1.0f, 0);
+  tst_isinf (make_f (0x7f80), 1);
+  tst_isinf (make_f (0xff80), -1);
+  tst_isinf (make_f (0x7f7f), 0);
+  tst_isinf (make_f (0xff7f), 0);
+  tst_isinf (make_f (0x7f81), 0);
+  tst_isinf (make_f (0xff81), 0);
+  tst_isinf (make_f (0x0080), 0);
+  tst_isinf (make_f (0x8080), 0);
+  tst_isinf (make_f (0x0040), 0);
+  tst_isinf (make_f (0x8040), 0);
+  
+  return 0;
+}
diff --git a/libgcc/config/avr/libf7/libf7-asm.sx 
b/libgcc/config/avr/libf7/libf7-asm.sx
index df315d35c73..84790d2f52d 100644
--- a/libgcc/config/avr/libf7/libf7-asm.sx
+++ b/libgcc/config/avr/libf7/libf7-asm.sx
@@ -1639,19 +1639,24 @@ _ENDF __copysign
 
 
 #ifdef F7MOD_D_isinf_
+;;; +Inf  ->  +1
+;;; -Inf  ->  -1
 _DEFUN __isinf
 DALIAS isinf
 LALIAS isinfl
+;; Save sign for later
+pushR25
 F7call  class_D
+pop TMP
+ldi R24,0
+ldi R25,0
 ;; Inf: T = Z = 1.
-brtc 0f
+brtc 0f ; ordinary number
+brne 0f ; Nan
 ldi R24,1
-breq 1f
-0:
-clr R24
-1:
-clr R25
-ret
+sbrcTMP,7
+sbiwR24,2
+0:  ret
 _ENDF __isinf
 #endif /* F7MOD_D_isinf_ */


[gcc r13-8817] AVR: tree-optimization/115307 - Work around isinf bloat from early passes.

2024-06-01 Thread Georg-Johann Lay via Gcc-cvs
https://gcc.gnu.org/g:c57d73f4cd5ca61327406fc2521a2235dd49d12e

commit r13-8817-gc57d73f4cd5ca61327406fc2521a2235dd49d12e
Author: Georg-Johann Lay 
Date:   Sat Jun 1 10:38:00 2024 +0200

AVR: tree-optimization/115307 - Work around isinf bloat from early passes.

PR tree-optimization/115307
gcc/
* config/avr/avr.md (SFDF): New mode iterator.
(isinf2) [sf, df]: New expanders.

gcc/testsuite/
* gcc.target/avr/torture/pr115307-isinf.c: New test.

(cherry picked from commit fabb545026f714b7d1cbe586f4c5bbf6430bdde3)

Diff:
---
 gcc/config/avr/avr.md   | 16 
 .../gcc.target/avr/torture/pr115307-isinf.c | 21 +
 2 files changed, 37 insertions(+)

diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md
index 866ce47d033..46f7812cea2 100644
--- a/gcc/config/avr/avr.md
+++ b/gcc/config/avr/avr.md
@@ -285,6 +285,8 @@
 (define_mode_iterator SPLIT34 [SI SF PSI
SQ USQ SA USA])
 
+(define_mode_iterator SFDF [SF DF])
+
 ;; Define code iterators
 ;; Define two incarnations so that we can build the cartesian product.
 (define_code_iterator any_extend  [sign_extend zero_extend])
@@ -9780,6 +9782,20 @@
 operands[4] = GEN_INT (bitno % 8);
   })
 
+
+;; Work around PR115307: Early passes expand isinf/f/l to a bloat.
+;; These passes do not consider costs, and there is no way to
+;; hook in or otherwise disable the generated bloat.
+
+;; isinfsf2  isinfdf2
+(define_expand "isinf2"
+  [(parallel [(match_operand:HI 0)
+  (match_operand:SFDF 1)])]
+  ""
+  {
+FAIL;
+  })
+
 
 ;; Fixed-point instructions
 (include "avr-fixed.md")
diff --git a/gcc/testsuite/gcc.target/avr/torture/pr115307-isinf.c 
b/gcc/testsuite/gcc.target/avr/torture/pr115307-isinf.c
new file mode 100644
index 000..6368bd205c5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/avr/torture/pr115307-isinf.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+
+int call_isinff (float f)
+{
+int isinff (float);
+return isinff (f);
+}
+
+int call_isinf (double f)
+{
+int isinf (double);
+return isinf (f);
+}
+
+int call_isinfl (long double f)
+{
+int isinfl (long double);
+return isinfl (f);
+}
+
+/* { dg-final { scan-assembler-not "unord" } } */


[gcc r15-969] analyzer: detect -Wanalyzer-allocation-size at call stmts [PR106203]

2024-06-01 Thread David Malcolm via Gcc-cvs
https://gcc.gnu.org/g:2b0a7fe3abfbd47081f714a0a1263afe00c5cfd9

commit r15-969-g2b0a7fe3abfbd47081f714a0a1263afe00c5cfd9
Author: David Malcolm 
Date:   Sat Jun 1 13:50:32 2024 -0400

analyzer: detect -Wanalyzer-allocation-size at call stmts [PR106203]

gcc/analyzer/ChangeLog:
PR analyzer/106203
* checker-event.h: Include "analyzer/event-loc-info.h".
(struct event_loc_info): Move to its own header file.
* diagnostic-manager.cc
(diagnostic_manager::emit_saved_diagnostic): Move creation of
event_loc_info here from add_final_event, and if we have a
stmt_finder, call its update_event_loc_info method.
* engine.cc (leak_stmt_finder::update_event_loc_info): New.
(exploded_node::detect_leaks): Likewise.
(exploded_node::detect_leaks): Pass nullptr as call_stmt arg to
region_model::pop_frame.
* event-loc-info.h: New file, with content taken from
checker-event.h.
* exploded-graph.h (stmt_finder::update_event_loc_info): New pure
virtual function.
* infinite-loop.cc (infinite_loop_diagnostic::add_final_event):
Update for change to vfunc signature.
* infinite-recursion.cc
(infinite_recursion_diagnostic::add_final_event): Likewise.
* pending-diagnostic.cc (pending_diagnostic::add_final_event):
Pass in the event_loc_info from the caller, rather than generating
it from a gimple stmt and enode.
* pending-diagnostic.h (pending_diagnostic::add_final_event):
Likewise.
* region-model.cc (region_model::on_longjmp): Pass nullptr as
call_stmt arg to region_model::pop_frame.
(region_model::update_for_return_gcall): Likewise, but pass
call_stmt.
(class caller_context): New.
(region_model::pop_frame): Add "call_stmt" argument.  Use it
and the frame_region with a caller_context when setting
result_dst_reg's value so that any diagnostic is reported at the
call stmt in the caller.
(selftest::test_stack_frames): Pass nullptr as call_stmt arg to
region_model::pop_frame.
(selftest::test_alloca): Likewise.
* region-model.h (region_model::pop_frame): Add "call_stmt"
argument.

gcc/testsuite/ChangeLog:
PR analyzer/106203
* c-c++-common/analyzer/allocation-size-1.c (test_9): Remove
xfail.
* c-c++-common/analyzer/allocation-size-2.c (test_8): Likewise.
* gcc.dg/analyzer/allocation-size-multiline-4.c: New test.
* gcc.dg/plugin/analyzer_cpython_plugin.c
(refcnt_stmt_finder::update_event_loc_info): New.

Signed-off-by: David Malcolm 

Diff:
---
 gcc/analyzer/checker-event.h   | 14 +---
 gcc/analyzer/diagnostic-manager.cc | 13 +++-
 gcc/analyzer/engine.cc |  7 +-
 gcc/analyzer/event-loc-info.h  | 41 +++
 gcc/analyzer/exploded-graph.h  |  1 +
 gcc/analyzer/infinite-loop.cc  |  2 +-
 gcc/analyzer/infinite-recursion.cc |  2 +-
 gcc/analyzer/pending-diagnostic.cc |  6 +-
 gcc/analyzer/pending-diagnostic.h  |  2 +-
 gcc/analyzer/region-model.cc   | 84 --
 gcc/analyzer/region-model.h|  1 +
 .../c-c++-common/analyzer/allocation-size-1.c  |  8 +--
 .../c-c++-common/analyzer/allocation-size-2.c  |  8 +--
 .../gcc.dg/analyzer/allocation-size-multiline-4.c  | 64 +
 .../gcc.dg/plugin/analyzer_cpython_plugin.c|  5 ++
 15 files changed, 216 insertions(+), 42 deletions(-)

diff --git a/gcc/analyzer/checker-event.h b/gcc/analyzer/checker-event.h
index 7a4510ee81d..d0935aca985 100644
--- a/gcc/analyzer/checker-event.h
+++ b/gcc/analyzer/checker-event.h
@@ -23,22 +23,10 @@ along with GCC; see the file COPYING3.  If not see
 
 #include "tree-logical-location.h"
 #include "analyzer/program-state.h"
+#include "analyzer/event-loc-info.h"
 
 namespace ana {
 
-/* A bundle of location information for a checker_event.  */
-
-struct event_loc_info
-{
-  event_loc_info (location_t loc, tree fndecl, int depth)
-  : m_loc (loc), m_fndecl (fndecl), m_depth (depth)
-  {}
-
-  location_t m_loc;
-  tree m_fndecl;
-  int m_depth;
-};
-
 /* An enum for discriminating between the concrete subclasses of
checker_event.  */
 
diff --git a/gcc/analyzer/diagnostic-manager.cc 
b/gcc/analyzer/diagnostic-manager.cc
index da98b9679cb..20e793d72c1 100644
--- a/gcc/analyzer/diagnostic-manager.cc
+++ b/gcc/analyzer/diagnostic-manager.cc
@@ -1588,8 +1588,17 @@ diagnostic_manager::emit_saved_diagnostic (const 
exploded_graph &eg,
  We use the final enode from the