public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Bug in GCC 7.1?
@ 2017-05-05  9:21 Helmut Zeisel
  2017-05-05  9:51 ` Marc Glisse
  0 siblings, 1 reply; 3+ messages in thread
From: Helmut Zeisel @ 2017-05-05  9:21 UTC (permalink / raw)
  To: gcc

The following program gives a warning under GCC 7.1 (built on cygwin, 64 bit)
 
#include <vector>
int main()
{
    std::vector<int> c {1,2,3,0};
    while(c.size() > 0 && c.back() == 0)
    {
        auto sz = c.size() -1;
        c.resize(sz);
    }
    return 0;
}
 
$ c++7.1 -O3 tt.cxx
In Funktion »int main()«:
cc1plus: Warnung: »void* __builtin_memset(void*, int, long unsigned int)«: angegebene Größe 18446744073709551612 überschreitet maximale Objektgröße 9223372036854775807 [-Wstringop-overflow=]
 
Compiling with GCC 6.1 (c++6.1 -O3 tt.cxx) works fine.
 
Is this a problem of my program or a problem of GCC 7.1?
 
Helmut

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Bug in GCC 7.1?
  2017-05-05  9:21 Bug in GCC 7.1? Helmut Zeisel
@ 2017-05-05  9:51 ` Marc Glisse
  2017-05-05 10:14   ` Helmut Zeisel
  0 siblings, 1 reply; 3+ messages in thread
From: Marc Glisse @ 2017-05-05  9:51 UTC (permalink / raw)
  To: Helmut Zeisel; +Cc: gcc

(I think you are looking for gcc-help@gcc.gnu.org, or gcc's bugzilla, 
rather than this mailing list)

On Fri, 5 May 2017, Helmut Zeisel wrote:

> The following program gives a warning under GCC 7.1 (built on cygwin, 64 bit)
>
> #include <vector>
> int main()
> {
>    std::vector<int> c {1,2,3,0};
>    while(c.size() > 0 && c.back() == 0)
>    {
>        auto sz = c.size() -1;
>        c.resize(sz);
>    }
>    return 0;
> }
>
> $ c++7.1 -O3 tt.cxx

Please use
$ LC_ALL=C c++7.1 -O3 tt.cxx
when you want to post the result, unless you are sending to a German 
forum.

> In Funktion »int main()«:
> cc1plus: Warnung: »void* __builtin_memset(void*, int, long unsigned int)«: angegebene Größe 18446744073709551612 überschreitet maximale Objektgröße 9223372036854775807 [-Wstringop-overflow=]
>
> Compiling with GCC 6.1 (c++6.1 -O3 tt.cxx) works fine.
>
> Is this a problem of my program or a problem of GCC 7.1?

Sounds like a problem with gcc, maybe optimization creates a path that 
corresponds to size==0 and fails to notice that it cannot be taken.

-- 
Marc Glisse

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Bug in GCC 7.1?
  2017-05-05  9:51 ` Marc Glisse
@ 2017-05-05 10:14   ` Helmut Zeisel
  0 siblings, 0 replies; 3+ messages in thread
From: Helmut Zeisel @ 2017-05-05 10:14 UTC (permalink / raw)
  To: gcc

I added it to bugzilla, Bug 80641

Helmut 
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-05-05 10:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-05  9:21 Bug in GCC 7.1? Helmut Zeisel
2017-05-05  9:51 ` Marc Glisse
2017-05-05 10:14   ` Helmut Zeisel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).