Hi David,

I’m seeing the following failures on building GCC with Apple’s clang:

> /Users/fx/devel/gcc/gcc-repo-write/gcc/analyzer/region-model.cc:3426:16: 
> error: unexpected type name 'byte_size_t': expected expression
>                            std::max<byte_size_t> (bytes.m_size_in_bytes,
>                                     ^
> /Users/fx/devel/gcc/gcc-repo-write/gcc/analyzer/region-model.cc:3426:12: 
> error: no member named 'max' in namespace 'std'; did you mean 'fmax'?
>                            std::max<byte_size_t> (bytes.m_size_in_bytes,
>                            ~~~~~^~~
>                                 fmax
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:420:9:
>  note: 'fmax' declared here
> using ::fmax _LIBCPP_USING_IF_EXISTS;
>         ^
> /Users/fx/devel/gcc/gcc-repo-write/gcc/analyzer/region-model.cc:3450:18: 
> error: expected '(' for function-style cast or type construction
>       = std::min<HOST_WIDE_INT> ((TREE_STRING_LENGTH (string_cst)
>                  ^~~~~~~~~~~~~
> /Users/fx/devel/gcc/gcc-repo-write/gcc/hwint.h:59:31: note: expanded from 
> macro 'HOST_WIDE_INT'
> #   define HOST_WIDE_INT long long
>                          ~~~~ ^
> /Users/fx/devel/gcc/gcc-repo-write/gcc/analyzer/region-model.cc:3450:14: 
> error: no member named 'min' in namespace 'std'
>       = std::min<HOST_WIDE_INT> ((TREE_STRING_LENGTH (string_cst)
>         ~~~~~^

std::max and std::min, introduced by d99d73c77d1e and 2bad0eeb5573, are not 
available because <algorithm> is not included. The following patch fixes the 
build for me:

diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc
index 4f31a6dcf0f..1ca8c8839bf 100644
--- a/gcc/analyzer/region-model.cc
+++ b/gcc/analyzer/region-model.cc
@@ -20,6 +20,7 @@ along with GCC; see the file COPYING3.  If not see
   #include "config.h"
 #define INCLUDE_MEMORY
+#define INCLUDE_ALGORITHM
 #include "system.h"
 #include "coretypes.h"
 #include "make-unique.h”


Could you check it is what you intended, and push it?

Thanks,
FX

Reply via email to