This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PR35503 - warn for restrict pointer


On 30 August 2016 at 05:34, David Malcolm <dmalcolm@redhat.com> wrote:
> On Mon, 2016-08-29 at 20:01 -0400, David Malcolm wrote:
>> On Mon, 2016-08-29 at 19:55 -0400, David Malcolm wrote:
>> [...]
>> > Assuming you have the location_t values available, you can create a
>> > rich_location for the primary range, and then add secondary ranges
>> > like
>> > this:
>> >
>> >   rich_location richloc (loc_of_arg1);
>>
>> Oops, the above should be:
>>
>>     rich_location richloc (line_table, loc_of_arg1);
>>
>> or:
>>
>>     gcc_rich_location (loc_of_arg1);
> and this should be:
>
>      gcc_rich_location richloc (loc_of_arg1);
>> which does the same thing (#include "gcc-rich-location.h").
>
> Clearly I need to sleep :)
Hi David,
Thanks for the suggestions. I can now see multiple source ranges for
pr35503-2.c (included in patch).
Output shows: http://pastebin.com/FNAVDU8A
(Posted pastebin link to avoid mangling by the mailer)

However the test for underline fails:
FAIL: c-c++-common/pr35503-2.c  -Wc++-compat   expected multiline
pattern lines 12-13 not found: "\s*f \(&alpha, &beta, &alpha,
&alpha\);.*\n      \^~~~~~         ~~~~~~  ~~~~~~ .*\n"
I have attached gcc.log for the test-case. Presumably I have written
the test-case incorrectly.
Could you please have a look at it ?

Thanks,
Prathamesh
>
>> >   richloc.add_range (loc_of_arg3, false);  /* false here = don't
>> > draw
>> > a
>> > caret, just the underline */
>> >   richloc.add_range (loc_of_arg4, false);
>> >   warning_at_rich_loc (&richloc, OPT_Wrestrict, etc...
>> >
>> > See line-map.h for more information on rich_location.
>>
>> [...]

Attachment: pr35503-5.diff
Description: Text document

Test Run By bilbo on Tue Aug 30 16:52:28 2016
Native configuration is x86_64-pc-linux-gnu

		=== gcc tests ===

Schedule of variations:
    unix

Running target unix
Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
Using /home/bilbo/gnu-toolchain/gcc/pr35503/gcc/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.
Running /home/bilbo/gnu-toolchain/gcc/pr35503/gcc/gcc/testsuite/gcc.dg/dg.exp ...
LD_LIBRARY_PATH=:/home/bilbo/gnu-toolchain/gcc/pr35503/stage1-build/gcc:/home/bilbo/gnu-toolchain/gcc/pr35503/stage1-build/gcc/32:
LD_RUN_PATH=:/home/bilbo/gnu-toolchain/gcc/pr35503/stage1-build/gcc:/home/bilbo/gnu-toolchain/gcc/pr35503/stage1-build/gcc/32
SHLIB_PATH=:/home/bilbo/gnu-toolchain/gcc/pr35503/stage1-build/gcc:/home/bilbo/gnu-toolchain/gcc/pr35503/stage1-build/gcc/32
LD_LIBRARY_PATH_32=:/home/bilbo/gnu-toolchain/gcc/pr35503/stage1-build/gcc:/home/bilbo/gnu-toolchain/gcc/pr35503/stage1-build/gcc/32:
LD_LIBRARY_PATH_64=:/home/bilbo/gnu-toolchain/gcc/pr35503/stage1-build/gcc:/home/bilbo/gnu-toolchain/gcc/pr35503/stage1-build/gcc/32:
DYLD_LIBRARY_PATH=:/home/bilbo/gnu-toolchain/gcc/pr35503/stage1-build/gcc:/home/bilbo/gnu-toolchain/gcc/pr35503/stage1-build/gcc/32
Executing on host: /home/bilbo/gnu-toolchain/gcc/pr35503/stage1-build/gcc/xgcc -B/home/bilbo/gnu-toolchain/gcc/pr35503/stage1-build/gcc/    -fno-diagnostics-show-caret -fdiagnostics-color=never  -flto -c -o lto13374.o lto13374.c    (timeout = 300)
spawn -ignore SIGHUP /home/bilbo/gnu-toolchain/gcc/pr35503/stage1-build/gcc/xgcc -B/home/bilbo/gnu-toolchain/gcc/pr35503/stage1-build/gcc/ -fno-diagnostics-show-caret -fdiagnostics-color=never -flto -c -o lto13374.o lto13374.c
Executing on host: /home/bilbo/gnu-toolchain/gcc/pr35503/stage1-build/gcc/xgcc -B/home/bilbo/gnu-toolchain/gcc/pr35503/stage1-build/gcc/ linker_plugin13374.c    -fno-diagnostics-show-caret -fdiagnostics-color=never  -flto -fuse-linker-plugin  -lm  -o linker_plugin13374.exe    (timeout = 300)
spawn -ignore SIGHUP /home/bilbo/gnu-toolchain/gcc/pr35503/stage1-build/gcc/xgcc -B/home/bilbo/gnu-toolchain/gcc/pr35503/stage1-build/gcc/ linker_plugin13374.c -fno-diagnostics-show-caret -fdiagnostics-color=never -flto -fuse-linker-plugin -lm -o linker_plugin13374.exe
Executing on host: /home/bilbo/gnu-toolchain/gcc/pr35503/stage1-build/gcc/xgcc -B/home/bilbo/gnu-toolchain/gcc/pr35503/stage1-build/gcc/ /home/bilbo/gnu-toolchain/gcc/pr35503/gcc/gcc/testsuite/c-c++-common/pr35503-2.c    -fno-diagnostics-show-caret -fdiagnostics-color=never   -Wc++-compat  -fdiagnostics-show-caret -Wrestrict -S -o pr35503-2.s    (timeout = 300)
spawn -ignore SIGHUP /home/bilbo/gnu-toolchain/gcc/pr35503/stage1-build/gcc/xgcc -B/home/bilbo/gnu-toolchain/gcc/pr35503/stage1-build/gcc/ /home/bilbo/gnu-toolchain/gcc/pr35503/gcc/gcc/testsuite/c-c++-common/pr35503-2.c -fno-diagnostics-show-caret -fdiagnostics-color=never -Wc++-compat -fdiagnostics-show-caret -Wrestrict -S -o pr35503-2.s
/home/bilbo/gnu-toolchain/gcc/pr35503/gcc/gcc/testsuite/c-c++-common/pr35503-2.c: In function 'foo':
/home/bilbo/gnu-toolchain/gcc/pr35503/gcc/gcc/testsuite/c-c++-common/pr35503-2.c:8:6: warning: passing argument 1 to restrict-qualified parameter aliases with arguments 3, 4 [-Wrestrict]
   f (&alpha, &beta, &alpha, &alpha);
      ^~~~~~         ~~~~~~  ~~~~~~
output is:
/home/bilbo/gnu-toolchain/gcc/pr35503/gcc/gcc/testsuite/c-c++-common/pr35503-2.c: In function 'foo':
/home/bilbo/gnu-toolchain/gcc/pr35503/gcc/gcc/testsuite/c-c++-common/pr35503-2.c:8:6: warning: passing argument 1 to restrict-qualified parameter aliases with arguments 3, 4 [-Wrestrict]
   f (&alpha, &beta, &alpha, &alpha);
      ^~~~~~         ~~~~~~  ~~~~~~

PASS: c-c++-common/pr35503-2.c  -Wc++-compat   (test for warnings, line 8)
FAIL: c-c++-common/pr35503-2.c  -Wc++-compat   expected multiline pattern lines 12-13 not found: "\s*f \(&alpha, &beta, &alpha, &alpha\);.*\n      \^~~~~~         ~~~~~~  ~~~~~~ .*\n"
FAIL: c-c++-common/pr35503-2.c  -Wc++-compat  (test for excess errors)
Excess errors:
   f (&alpha, &beta, &alpha, &alpha);
      ^~~~~~         ~~~~~~  ~~~~~~

testcase /home/bilbo/gnu-toolchain/gcc/pr35503/gcc/gcc/testsuite/gcc.dg/dg.exp completed in 0 seconds

		=== gcc Summary ===

# of expected passes		1
# of unexpected failures	2
Executing on host: /home/bilbo/gnu-toolchain/gcc/pr35503/stage1-build/gcc/xgcc -v    (timeout = 300)
spawn -ignore SIGHUP /home/bilbo/gnu-toolchain/gcc/pr35503/stage1-build/gcc/xgcc -v
Using built-in specs.
COLLECT_GCC=/home/bilbo/gnu-toolchain/gcc/pr35503/stage1-build/gcc/xgcc
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --enable-languages=c,c++,fortran --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160824 (experimental) (GCC) 
/home/bilbo/gnu-toolchain/gcc/pr35503/stage1-build/gcc/xgcc  version 7.0.0 20160824 (experimental) (GCC) 

runtest completed at Tue Aug 30 16:52:28 2016

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]