public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/50599] New: -ftree-vectorize generating incorrect code
@ 2011-10-03 14:50 a5970694 at nepwk dot com
  2011-10-04 11:05 ` [Bug tree-optimization/50599] " rguenth at gcc dot gnu.org
  2015-10-20  9:25 ` mpolacek at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: a5970694 at nepwk dot com @ 2011-10-03 14:50 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50599

             Bug #: 50599
           Summary: -ftree-vectorize generating incorrect code
    Classification: Unclassified
           Product: gcc
           Version: 4.5.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: a5970694@nepwk.com


MinGW x86 4.5.2
A loop:
while(total_out < decompressed_size)
        {
            printf("%X\n",p);
            int chunk_size = *(int*)p;
            if(chunk_size > 0)
            {            
                int ret = params->decompressor(p+sizeof(int), chunk_size,
params->out+total_out, std::min(params->osize-total_out,params->bsize),
params->other);

                int real_out = (ret / params->ssize) * params->ssize;
                if(real_out != ret)
                    real_out += params->ssize;
                if(total_out + real_out >= params->isize)
                    total_out += ret;
                else
                    total_out += real_out;
                p += chunk_size+sizeof(int);

            }
            else
            {
                if(params->verify)
                {
                    memcpy(params->out+total_out, p+sizeof(int), -chunk_size);
                    p += -chunk_size;
                }
                total_out += -chunk_size;
                p += sizeof(int);
            }
        }
Compiled with -O3 -fno-strict-aliasing works funny - the printf is called twice
with the same address. And on some data I'm getting crashes in
params->decompressor, which is a 3rd party code.
I added other printfs and I see that when running the loop for the 1st time,
the code enters the 1st branch, goes to p += chunk_size+sizeof(int), increases,
goes out of the if and iterates the loop again with unchanged p.

Adding -fno-tree-vectorize solves the problem.


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

* [Bug tree-optimization/50599] -ftree-vectorize generating incorrect code
  2011-10-03 14:50 [Bug tree-optimization/50599] New: -ftree-vectorize generating incorrect code a5970694 at nepwk dot com
@ 2011-10-04 11:05 ` rguenth at gcc dot gnu.org
  2015-10-20  9:25 ` mpolacek at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-10-04 11:05 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50599

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2011-10-04
     Ever Confirmed|0                           |1

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-10-04 11:05:03 UTC ---
We need a testcase that can be at least compiled that shows the problem.  Best
if it can be executed and shows the issue in runtime behavior.


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

* [Bug tree-optimization/50599] -ftree-vectorize generating incorrect code
  2011-10-03 14:50 [Bug tree-optimization/50599] New: -ftree-vectorize generating incorrect code a5970694 at nepwk dot com
  2011-10-04 11:05 ` [Bug tree-optimization/50599] " rguenth at gcc dot gnu.org
@ 2015-10-20  9:25 ` mpolacek at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-10-20  9:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50599

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
                 CC|                            |mpolacek at gcc dot gnu.org
         Resolution|---                         |INVALID

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Test case not coming.


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

end of thread, other threads:[~2015-10-20  9:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-03 14:50 [Bug tree-optimization/50599] New: -ftree-vectorize generating incorrect code a5970694 at nepwk dot com
2011-10-04 11:05 ` [Bug tree-optimization/50599] " rguenth at gcc dot gnu.org
2015-10-20  9:25 ` mpolacek at gcc dot gnu.org

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).