You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by GitBox <gi...@apache.org> on 2020/08/30 22:08:05 UTC

[GitHub] [trafficserver] thelounge-zz opened a new issue #7151: 8.1.0: compiler warnings

thelounge-zz opened a new issue #7151:
URL: https://github.com/apache/trafficserver/issues/7151


   after nearly 20 years in the business i still don't get ignoreed compiler warnings, let#s pray to god that at least keep-alive with 8.1 no longer results in random crashes
   
   ink_hrtime.cc: In function 'int64_to_str':
   ink_hrtime.cc:146:10: warning: function may return address of local variable [-Wreturn-local-addr]
     146 |   return out_buf;
         |          ^
   ink_hrtime.cc:49:8: note: declared here
      49 |   char local_buf[local_buf_size];
   ControlMatcher.cc: In member function 'AllocateSpace':
   ControlMatcher.cc:418:16: warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
     418 |   data_array = new Data[num_entries];
         |                ^
   /usr/include/c++/10/new:128:26: note: in a call to allocation function 'operator new []' declared here
     128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
         |                          ^
   ControlMatcher.cc: In member function 'AllocateSpace':
   ControlMatcher.cc:280:16: warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
     280 |   data_array = new Data[num_entries];
         |                ^
   /usr/include/c++/10/new:128:26: note: in a call to allocation function 'operator new []' declared here
     128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
         |                          ^
   ControlMatcher.cc: In member function 'AllocateSpace':
   ControlMatcher.cc:418:16: warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
     418 |   data_array = new Data[num_entries];
         |                ^
   /usr/include/c++/10/new:128:26: note: in a call to allocation function 'operator new []' declared here
     128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
         |                          ^
   ControlMatcher.cc: In member function 'AllocateSpace':
   ControlMatcher.cc:280:16: warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
     280 |   data_array = new Data[num_entries];
         |                ^
   /usr/include/c++/10/new:128:26: note: in a call to allocation function 'operator new []' declared here
     128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
         |                          ^
   ControlMatcher.cc: In member function 'AllocateSpace':
   ControlMatcher.cc:418:16: warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
     418 |   data_array = new Data[num_entries];
         |                ^
   /usr/include/c++/10/new:128:26: note: in a call to allocation function 'operator new []' declared here
     128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
         |                          ^
   ControlMatcher.cc: In member function 'AllocateSpace':
   ControlMatcher.cc:280:16: warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
     280 |   data_array = new Data[num_entries];
         |                ^
   /usr/include/c++/10/new:128:26: note: in a call to allocation function 'operator new []' declared here
     128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
         |                          ^
   ControlMatcher.cc: In member function 'AllocateSpace':
   ControlMatcher.cc:418:16: warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
     418 |   data_array = new Data[num_entries];
         |                ^
   /usr/include/c++/10/new:128:26: note: in a call to allocation function 'operator new []' declared here
     128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
         |                          ^
   ControlMatcher.cc: In member function 'AllocateSpace':
   ControlMatcher.cc:280:16: warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
     280 |   data_array = new Data[num_entries];
         |                ^
   /usr/include/c++/10/new:128:26: note: in a call to allocation function 'operator new []' declared here
     128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
         |                          ^
   ControlMatcher.cc: In member function 'AllocateSpace':
   ControlMatcher.cc:418:16: warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
     418 |   data_array = new Data[num_entries];
         |                ^
   /usr/include/c++/10/new:128:26: note: in a call to allocation function 'operator new []' declared here
     128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
         |                          ^
   ControlMatcher.cc: In member function 'AllocateSpace':
   ControlMatcher.cc:280:16: warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
     280 |   data_array = new Data[num_entries];
         |                ^
   /usr/include/c++/10/new:128:26: note: in a call to allocation function 'operator new []' declared here
     128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
         |                          ^
   ControlMatcher.cc: In member function 'AllocateSpace':
   ControlMatcher.cc:418:16: warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
     418 |   data_array = new Data[num_entries];
         |                ^
   /usr/include/c++/10/new:128:26: note: in a call to allocation function 'operator new []' declared here
     128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
         |                          ^
   ControlMatcher.cc: In member function 'AllocateSpace':
   ControlMatcher.cc:280:16: warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
     280 |   data_array = new Data[num_entries];
         |                ^
   /usr/include/c++/10/new:128:26: note: in a call to allocation function 'operator new []' declared here
     128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] zwoop edited a comment on issue #7151: 8.1.0: compiler warnings

Posted by GitBox <gi...@apache.org>.
zwoop edited a comment on issue #7151:
URL: https://github.com/apache/trafficserver/issues/7151#issuecomment-687892223


   This one is particularly odd:
   
   ```
   ControlMatcher.cc:280:16: warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
     280 |   data_array = new Data[num_entries];
   ```
   
   That sounds to me like the compiler is assuming num_entries is a value of UINT64_MAX. Which is pretty darn strange, assuming that sizeof(int)  == 4 here (i.e. 32-bit).


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] zwoop edited a comment on issue #7151: 8.1.0: compiler warnings

Posted by GitBox <gi...@apache.org>.
zwoop edited a comment on issue #7151:
URL: https://github.com/apache/trafficserver/issues/7151#issuecomment-687892223


   This one is particularly odd:
   
   ```
   ControlMatcher.cc:280:16: warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
     280 |   data_array = new Data[num_entries];
   ```
   
   That sounds to me like the compiler is assuming num_entries is a value of MAX_UINT64.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] thelounge-zz commented on issue #7151: 8.1.0: compiler warnings

Posted by GitBox <gi...@apache.org>.
thelounge-zz commented on issue #7151:
URL: https://github.com/apache/trafficserver/issues/7151#issuecomment-688108971


   can i have a unifid diff or even better a patched tarball fro rpmbuild?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] thelounge-zz commented on issue #7151: 8.1.0: compiler warnings

Posted by GitBox <gi...@apache.org>.
thelounge-zz commented on issue #7151:
URL: https://github.com/apache/trafficserver/issues/7151#issuecomment-738862789


   8.1.1 looks very similar
   
     CXX      ParseRules.lo
     CXXLD    libtscore.la
   ink_hrtime.cc: In function 'int64_to_str':
   ink_hrtime.cc:146:10: warning: function may return address of local variable [-Wreturn-local-addr]
     146 |   return out_buf;
         |          ^
   ink_hrtime.cc:49:8: note: declared here
      49 |   char local_buf[local_buf_size];
         |        ^
   Making all in iocore
   Making all in eventsystem
     CXX      ReverseProxy.o
     CXX      StatPages.o
     CXX      Transform.o
     AR       libproxy.a
   ControlMatcher.cc: In member function 'AllocateSpace':
   ControlMatcher.cc:418:16: warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
     418 |   data_array = new Data[num_entries];
         |                ^
   /usr/include/c++/10/new:128:26: note: in a call to allocation function 'operator new []' declared here
     128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
         |                          ^
   ControlMatcher.cc: In member function 'AllocateSpace':
   ControlMatcher.cc:280:16: warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
     280 |   data_array = new Data[num_entries];
         |                ^
   /usr/include/c++/10/new:128:26: note: in a call to allocation function 'operator new []' declared here
     128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
         |                          ^
   ControlMatcher.cc: In member function 'AllocateSpace':
   ControlMatcher.cc:418:16: warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
     418 |   data_array = new Data[num_entries];
         |                ^
   /usr/include/c++/10/new:128:26: note: in a call to allocation function 'operator new []' declared here
     128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
         |                          ^
   ControlMatcher.cc: In member function 'AllocateSpace':
   ControlMatcher.cc:280:16: warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
     280 |   data_array = new Data[num_entries];
         |                ^
   /usr/include/c++/10/new:128:26: note: in a call to allocation function 'operator new []' declared here
     128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
         |                          ^
   ControlMatcher.cc: In member function 'AllocateSpace':
   ControlMatcher.cc:418:16: warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
     418 |   data_array = new Data[num_entries];
         |                ^
   /usr/include/c++/10/new:128:26: note: in a call to allocation function 'operator new []' declared here
     128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
         |                          ^
   ControlMatcher.cc: In member function 'AllocateSpace':
   ControlMatcher.cc:280:16: warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
     280 |   data_array = new Data[num_entries];
         |                ^
   /usr/include/c++/10/new:128:26: note: in a call to allocation function 'operator new []' declared here
     128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
         |                          ^
   ControlMatcher.cc: In member function 'AllocateSpace':
   ControlMatcher.cc:418:16: warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
     418 |   data_array = new Data[num_entries];
         |                ^
   /usr/include/c++/10/new:128:26: note: in a call to allocation function 'operator new []' declared here
     128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
         |                          ^
   ControlMatcher.cc: In member function 'AllocateSpace':
   ControlMatcher.cc:280:16: warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
     280 |   data_array = new Data[num_entries];
         |                ^
   /usr/include/c++/10/new:128:26: note: in a call to allocation function 'operator new []' declared here
     128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
         |                          ^
   ControlMatcher.cc: In member function 'AllocateSpace':
   ControlMatcher.cc:418:16: warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
     418 |   data_array = new Data[num_entries];
         |                ^
   /usr/include/c++/10/new:128:26: note: in a call to allocation function 'operator new []' declared here
     128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
         |                          ^
   ControlMatcher.cc: In member function 'AllocateSpace':
   ControlMatcher.cc:280:16: warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
     280 |   data_array = new Data[num_entries];
         |                ^
   /usr/include/c++/10/new:128:26: note: in a call to allocation function 'operator new []' declared here
     128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
         |                          ^
   ControlMatcher.cc: In member function 'AllocateSpace':
   ControlMatcher.cc:418:16: warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
     418 |   data_array = new Data[num_entries];
         |                ^
   /usr/include/c++/10/new:128:26: note: in a call to allocation function 'operator new []' declared here
     128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
         |                          ^
   ControlMatcher.cc: In member function 'AllocateSpace':
   ControlMatcher.cc:280:16: warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
     280 |   data_array = new Data[num_entries];
         |                ^
   /usr/include/c++/10/new:128:26: note: in a call to allocation function 'operator new []' declared here
     128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] zwoop commented on issue #7151: 8.1.0: compiler warnings

Posted by GitBox <gi...@apache.org>.
zwoop commented on issue #7151:
URL: https://github.com/apache/trafficserver/issues/7151#issuecomment-687895430


   @thelounge-zz  Can you test the following patch, and see if it gets rid of that odd warning in ControlMatcher?
   
   ```
   diff --git a/include/tscore/HostLookup.h b/include/tscore/HostLookup.h
   index e5135d8b5..124e04fae 100644
   --- a/include/tscore/HostLookup.h
   +++ b/include/tscore/HostLookup.h
   @@ -124,7 +124,7 @@ public:
    
      HostLookup(std::string_view name);
      void NewEntry(std::string_view match_data, bool domain_record, void *opaque_data_in);
   -  void AllocateSpace(int num_entries);
   +  void AllocateSpace(size_t num_entries);
      bool Match(std::string_view host);
      bool Match(std::string_view host, void **opaque_ptr);
      bool MatchFirst(std::string_view host, HostLookupState *s, void **opaque_ptr);
   diff --git a/iocore/cache/CacheHosting.cc b/iocore/cache/CacheHosting.cc
   index 41c995742..63c62c954 100644
   --- a/iocore/cache/CacheHosting.cc
   +++ b/iocore/cache/CacheHosting.cc
   @@ -72,12 +72,12 @@ CacheHostMatcher::PrintFunc(void *opaque_data)
      d->Print();
    }
    
   -// void CacheHostMatcher::AllocateSpace(int num_entries)
   +// void CacheHostMatcher::AllocateSpace(size_t num_entries)
    //
    //  Allocates the the HostLeaf and Data arrays
    //
    void
   -CacheHostMatcher::AllocateSpace(int num_entries)
   +CacheHostMatcher::AllocateSpace(size_t num_entries)
    {
      // Should not have been allocated before
      ink_assert(array_len == -1);
   diff --git a/iocore/cache/P_CacheHosting.h b/iocore/cache/P_CacheHosting.h
   index e6eaa764e..52072818a 100644
   --- a/iocore/cache/P_CacheHosting.h
   +++ b/iocore/cache/P_CacheHosting.h
   @@ -74,7 +74,7 @@ public:
      CacheHostMatcher(const char *name, CacheType typ);
      ~CacheHostMatcher();
    
   -  void AllocateSpace(int num_entries);
   +  void AllocateSpace(size_t num_entries);
      void NewEntry(matcher_line *line_info);
    
      void Match(const char *rdata, int rlen, CacheHostResult *result) const;
   diff --git a/proxy/ControlMatcher.cc b/proxy/ControlMatcher.cc
   index 3b51cb57d..83c19d2d5 100644
   --- a/proxy/ControlMatcher.cc
   +++ b/proxy/ControlMatcher.cc
   @@ -125,13 +125,13 @@ HostMatcher<Data, MatchResult>::PrintFunc(void *opaque_data)
      d->Print();
    }
    
   -// void HostMatcher<Data,MatchResult>::AllocateSpace(int num_entries)
   +// void HostMatcher<Data,MatchResult>::AllocateSpace(size_t num_entries)
    //
    //  Allocates the the HostLeaf and Data arrays
    //
    template <class Data, class MatchResult>
    void
   -HostMatcher<Data, MatchResult>::AllocateSpace(int num_entries)
   +HostMatcher<Data, MatchResult>::AllocateSpace(size_t num_entries)
    {
      // Should not have been allocated before
      ink_assert(array_len == -1);
   @@ -266,14 +266,15 @@ UrlMatcher<Data, MatchResult>::Print() const
    }
    
    //
   -// void UrlMatcher<Data,MatchResult>::AllocateSpace(int num_entries)
   +// void UrlMatcher<Data,MatchResult>::AllocateSpace(size_t num_entries)
    //
    template <class Data, class MatchResult>
    void
   -UrlMatcher<Data, MatchResult>::AllocateSpace(int num_entries)
   +UrlMatcher<Data, MatchResult>::AllocateSpace(size_t num_entries)
    {
      // Should not have been allocated before
      ink_assert(array_len == -1);
   +  ink_release_assert(num_entries < UINT_MAX);
    
      data_array = new Data[num_entries];
      url_value  = new int[num_entries];
   @@ -399,11 +400,11 @@ RegexMatcher<Data, MatchResult>::Print() const
    }
    
    //
   -// void RegexMatcher<Data,MatchResult>::AllocateSpace(int num_entries)
   +// void RegexMatcher<Data,MatchResult>::AllocateSpace(size_t num_entries)
    //
    template <class Data, class MatchResult>
    void
   -RegexMatcher<Data, MatchResult>::AllocateSpace(int num_entries)
   +RegexMatcher<Data, MatchResult>::AllocateSpace(size_t num_entries)
    {
      // Should not have been allocated before
      ink_assert(array_len == -1);
   @@ -575,11 +576,11 @@ IpMatcher<Data, MatchResult>::IpMatcher(const char *name, const char *filename)
    }
    
    //
   -// void IpMatcher<Data,MatchResult>::AllocateSpace(int num_entries)
   +// void IpMatcher<Data,MatchResult>::AllocateSpace(size_t num_entries)
    //
    template <class Data, class MatchResult>
    void
   -IpMatcher<Data, MatchResult>::AllocateSpace(int num_entries)
   +IpMatcher<Data, MatchResult>::AllocateSpace(size_t num_entries)
    {
      // Should not have been allocated before
      ink_assert(array_len == -1);
   diff --git a/proxy/ControlMatcher.h b/proxy/ControlMatcher.h
   index 6c1a3cbda..70b89110d 100644
   --- a/proxy/ControlMatcher.h
   +++ b/proxy/ControlMatcher.h
   @@ -184,7 +184,7 @@ public:
      UrlMatcher(const char *name, const char *filename);
      ~UrlMatcher();
    
   -  void AllocateSpace(int num_entries);
   +  void AllocateSpace(size_t num_entries);
      Result NewEntry(matcher_line *line_info);
    
      void Match(RequestData *rdata, MatchResult *result) const;
   @@ -210,7 +210,7 @@ public:
      RegexMatcher(const char *name, const char *filename);
      ~RegexMatcher();
    
   -  void AllocateSpace(int num_entries);
   +  void AllocateSpace(size_t num_entries);
      Result NewEntry(matcher_line *line_info);
    
      void Match(RequestData *rdata, MatchResult *result) const;
   @@ -250,7 +250,7 @@ public:
      HostMatcher(const char *name, const char *filename);
      ~HostMatcher();
    
   -  void AllocateSpace(int num_entries);
   +  void AllocateSpace(size_t num_entries);
      Result NewEntry(matcher_line *line_info);
    
      void Match(RequestData *rdata, MatchResult *result) const;
   @@ -280,7 +280,7 @@ template <class Data, class MatchResult> class IpMatcher : protected BaseMatcher
    public:
      IpMatcher(const char *name, const char *filename);
    
   -  void AllocateSpace(int num_entries);
   +  void AllocateSpace(size_t num_entries);
      Result NewEntry(matcher_line *line_info);
    
      void Match(sockaddr const *ip_addr, RequestData *rdata, MatchResult *result) const;
   diff --git a/src/tscore/HostLookup.cc b/src/tscore/HostLookup.cc
   index b695e0f47..97e72925f 100644
   --- a/src/tscore/HostLookup.cc
   +++ b/src/tscore/HostLookup.cc
   @@ -926,12 +926,12 @@ HostLookup::MatchNext(HostLookupState *s, void **opaque_ptr)
      return false;
    }
    
   -// void HostLookup::AllocateSpace(int num_entries)
   +// void HostLookup::AllocateSpace(size_t num_entries)
    //
    //   Allocate the leaf array structure
    //
    void
   -HostLookup::AllocateSpace(int num_entries)
   +HostLookup::AllocateSpace(size_t num_entries)
    {
      leaf_array.reserve(num_entries);
    }
   ```
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] zwoop commented on issue #7151: 8.1.0: compiler warnings

Posted by GitBox <gi...@apache.org>.
zwoop commented on issue #7151:
URL: https://github.com/apache/trafficserver/issues/7151#issuecomment-687891501


   It's probably one of the additional options, such as
   
   ```
   -Wp,-D_FORTIFY_SOURCE=2 -w -Wformat -Werror=format-security
   ```
   
   We should fix this though.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] bryancall commented on issue #7151: 8.1.0: compiler warnings

Posted by GitBox <gi...@apache.org>.
bryancall commented on issue #7151:
URL: https://github.com/apache/trafficserver/issues/7151#issuecomment-686780445


   What OS and compiler are you using?  On all of our CI jobs for 8.1.x we use -Werror


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] zwoop edited a comment on issue #7151: 8.1.0: compiler warnings

Posted by GitBox <gi...@apache.org>.
zwoop edited a comment on issue #7151:
URL: https://github.com/apache/trafficserver/issues/7151#issuecomment-687892223


   This one is particularly odd:
   
   ```
   ControlMatcher.cc:280:16: warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
     280 |   data_array = new Data[num_entries];
   ```
   
   That sounds to me like the compiler is assuming num_entries is a value of UINT64_MAX.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] bneradt commented on issue #7151: 8.1.0: compiler warnings

Posted by GitBox <gi...@apache.org>.
bneradt commented on issue #7151:
URL: https://github.com/apache/trafficserver/issues/7151#issuecomment-969583759


   @bryancall can you please provide an update on this? I know you've been testing with Fedora and have fixed compiler warnings with recent OS/compiler versions. Did that address any of this?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] zwoop commented on issue #7151: 8.1.0: compiler warnings

Posted by GitBox <gi...@apache.org>.
zwoop commented on issue #7151:
URL: https://github.com/apache/trafficserver/issues/7151#issuecomment-687892223


   This one is particularly odd:
   
   ```
   ControlMatcher.cc:280:16: warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
     280 |   data_array = new Data[num_entries];
   ```
   
   That sounds to me like the compiler is assuming num_entries is a value of MAX_INT64.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] zwoop commented on issue #7151: 8.1.0: compiler warnings

Posted by GitBox <gi...@apache.org>.
zwoop commented on issue #7151:
URL: https://github.com/apache/trafficserver/issues/7151#issuecomment-687897654


   @thelounge-zz Can you try this patch for the ink_hrtime.cc bogus warning?
   
   ```
   diff --git a/src/tscore/ink_hrtime.cc b/src/tscore/ink_hrtime.cc
   index 9bffa1a53..201b63cab 100644
   --- a/src/tscore/ink_hrtime.cc
   +++ b/src/tscore/ink_hrtime.cc
   @@ -49,7 +49,6 @@ int64_to_str(char *buf, unsigned int buf_size, int64_t val, unsigned int *total_
      char local_buf[local_buf_size];
      bool using_local_buffer = false;
      bool negative           = false;
   -  char *out_buf           = buf;
      char *working_buf;
    
      if (buf_size < 22) {
   @@ -134,10 +133,9 @@ int64_to_str(char *buf, unsigned int buf_size, int64_t val, unsigned int *total_
      if (using_local_buffer) {
        if (num_chars <= buf_size) {
          memcpy(buf, working_buf, num_chars);
   -      // out_buf is already pointing to buf
        } else {
   -      // data does not fit return nullptr
   -      out_buf = nullptr;
   +      // data does not fit, return nullptr
   +      buf = nullptr;
        }
      }
    
   @@ -145,7 +143,7 @@ int64_to_str(char *buf, unsigned int buf_size, int64_t val, unsigned int *total_
        *total_chars = num_chars;
      }
    
   -  return out_buf;
   +  return buf;
    }
    
    int
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] zwoop commented on issue #7151: 8.1.0: compiler warnings

Posted by GitBox <gi...@apache.org>.
zwoop commented on issue #7151:
URL: https://github.com/apache/trafficserver/issues/7151#issuecomment-687896158


   This one looks outright wrong, as in, the compiler is wrong:
   
   ```
   ink_hrtime.cc: In function 'int64_to_str':
   ink_hrtime.cc:146:10: warning: function may return address of local variable [-Wreturn-local-addr]
     146 |   return out_buf;
   ```
   
   out_buf is set to point to "buf", or nullptr, so our code is definitely correct. Not sure how we can make sure your compiler ignores this... @SolidWallOfCode Got any ideas ?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] thelounge-zz commented on issue #7151: 8.1.0: compiler warnings

Posted by GitBox <gi...@apache.org>.
thelounge-zz commented on issue #7151:
URL: https://github.com/apache/trafficserver/issues/7151#issuecomment-686790908


   * gcc-10.2.1-1.fc32.x86_64
   * Fedora 32
   * -flto
   
   [root@testserver:~]$ cat /home/builduser/.rpmrc
   optflags: x86_64 -m64 -O2 -g0 -march=sandybridge -mtune=sandybridge -mfpmath=sse -msse2avx -ftree-slp-vectorize -fopenmp -pipe -fno-strict-aliasing -fomit-frame-pointer -fexceptions -fno-asynchronous-unwind-tables -fstack-protector-strong --param=ssp-buffer-size=6 -Wp,-D_FORTIFY_SOURCE=2 -w -Wformat -Werror=format-security -fPIC
   
   %build
   export CFLAGS="%{optflags} --param=ssp-buffer-size=8 -fPIC -flto=%(nproc)"
   export CXXFLAGS="$CFLAGS"
   export CPPFLAGS="$CFLAGS"
   export CC="gcc $CFLAGS"
   export SH_LDFLAGS="-Wl,--as-needed -Wl,-z,now -Wl,-z,relro %{optflags} --param=ssp-buffer-size=8 -flto=%(nproc)"
   export LDFLAGS="$SH_LDFLAGS -pie -fPIE"
   ./configure --quiet --enable-layout=Gentoo \
    --libdir=%{_libdir}/%{name} \
    --disable-curl \
    --disable-debug \
    --disable-diags \
    --disable-hwloc \
    --disable-static \
    --disable-tests \
    --disable-unwind \
    --enable-shared  \
    --with-brotli=%{_prefix} \
    --with-group=ats \
    --with-luajit=%{_prefix} \
    --with-lzma=%{_prefix} \
    --with-openssl=%{_prefix} \
    --with-pcre=%{_prefix} \
    --with-pic \
    --with-tcl=%{_libdir} \
    --with-user=ats \
    --with-zlib=%{_prefix} \
    --without-jemalloc
   %{__make} --quiet %{?_smp_mflags}


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org