Bug 86618 - tree-vect-stmts.c:3340: ubsan error
Summary: tree-vect-stmts.c:3340: ubsan error
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 8.0
: P3 normal
Target Milestone: ---
Assignee: rsandifo@gcc.gnu.org
URL:
Keywords:
Depends on:
Blocks: ubsan
  Show dependency treegraph
 
Reported: 2018-07-21 06:58 UTC by David Binderman
Modified: 2018-07-25 08:44 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2018-07-23 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Binderman 2018-07-21 06:58:28 UTC
The following C code 

register struct a *b asm("%r15");
struct a {
  double *c
} d() {
  (*b).c[1] = copysign(1, (*b).c[1]);
  (*b).c[0] = copysign(0, (*b).c[0]);
}

Seems to generate a new runtime error on a ubsan verison of gcc trunk

../results.262549.ubsan/bin/gcc
../results.262835.ubsan/bin/gcc
../../trunk/gcc/tree-vect-stmts.c:3340:19: runtime error: member access within n
ull pointer of type 'struct _loop_vec_info'

So the error seems to appeared between revisions 262549 and 262835.
Comment 1 David Binderman 2018-07-21 07:00:34 UTC
svn blame says

262589   rsandifo   vec_loop_masks *masks = &LOOP_VINFO_MASKS (loop_vinfo);
Comment 2 David Binderman 2018-07-21 07:02:07 UTC
gcc compiler flag -O3 required.
Comment 3 Martin Liška 2018-07-23 12:10:39 UTC
Confirmed.
Comment 4 rsandifo@gcc.gnu.org 2018-07-24 18:08:50 UTC
Author: rsandifo
Date: Tue Jul 24 18:08:19 2018
New Revision: 262951

URL: https://gcc.gnu.org/viewcvs?rev=262951&root=gcc&view=rev
Log:
Avoid &LOOP_VINFO_MASKS for bb vectorisation (PR 86618)

r262589 introduced another instance of the bug fixed in r258131.

2018-07-23  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	PR tree-optimization/86618
	* tree-vect-stmts.c (vectorizable_call): Don't take the address
	of LOOP_VINFO_MASKS (loop_vinfo) when loop_vinfo is null.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/tree-vect-stmts.c
Comment 5 rsandifo@gcc.gnu.org 2018-07-25 08:44:00 UTC
Fixed by r262951.