Bug 53088 - [4.8 Regression] gcc.target/i386/pr39082-1.c
Summary: [4.8 Regression] gcc.target/i386/pr39082-1.c
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.8.0
: P3 normal
Target Milestone: 4.8.0
Assignee: Jan Hubicka
URL:
Keywords:
Depends on:
Blocks: 53089
  Show dependency treegraph
 
Reported: 2012-04-23 16:59 UTC by H.J. Lu
Modified: 2012-09-07 11:25 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2012-04-23 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2012-04-23 16:59:41 UTC
On Linux/x86-64, revision 186687:

http://gcc.gnu.org/ml/gcc-cvs/2012-04/msg00639.html

gave

FAIL: gcc.target/i386/pr39082-1.c  (test for warnings, line 33)

./xgcc -B./ -S ../../src-trunk/gcc/testsuite/gcc.target/i386/pr39082-1.c -O2
../../src-trunk/gcc/testsuite/gcc.target/i386/pr39082-1.c: In function ‘foo1’:
../../src-trunk/gcc/testsuite/gcc.target/i386/pr39082-1.c:16:1: note: the ABI of passing union with long double has changed in GCC 4.4
 foo1 (union un u)
 ^

Revision 186685 gave

gcc -S -O2 gcc/gcc/testsuite/gcc.target/i386/pr39082-1.c
gcc/gcc/testsuite/gcc.target/i386/pr39082-1.c: In function ‘foo3’:
gcc/gcc/testsuite/gcc.target/i386/pr39082-1.c:33:12: note: the ABI of passing union with long double has changed in GCC 4.4
   union un u = bar2 (x); /* { dg-message "note: the ABI of passing union with long double has changed in GCC 4.4" } */
            ^
Comment 1 Jan Hubicka 2012-04-23 18:40:29 UTC
Mine.  i386 outputs the message with input_loc, so it seems we need to set it correctly.
Comment 2 Richard Biener 2012-04-23 18:54:41 UTC
(In reply to comment #1)
> Mine.  i386 outputs the message with input_loc, so it seems we need to set it
> correctly.

It should use some more sensible location though - input_location should be
essentially non-accessible from outside the frontend.  Also see the bogus
caret on the function prototype (which should point to the union parameter?)
Comment 3 Jan Hubicka 2012-04-24 15:07:21 UTC
At few places in cgraph code we set location to get those late diagnostics right. It sort of makes sense for function wide diagnostics, but it is not this one.

(gdb) bt
#0  inform (location=1925, gmsgid=0x379f4b8 "the ABI of passing union with long double has changed in GCC 4.4") at ../../gcc/diagnostic.c:745
#1  0x00000000029a5f2b in classify_argument (mode=BLKmode, type=0x7ffff77a9498, classes=0x7fffffffded0, bit_offset=0) at ../../gcc/config/i386/i386.c:6124
#2  0x00000000029a6635 in examine_argument (mode=BLKmode, type=0x7ffff77a9498, in_return=0, int_nregs=0x7fffffffdf38, sse_nregs=0x7fffffffdf34) at ../../gcc/config/i386/i386.c:6311
#3  0x00000000029a71e9 in function_arg_advance_64 (cum=0x7fffffffe090, mode=BLKmode, type=0x7ffff77a9498, words=2, named=1 '\001') at ../../gcc/config/i386/i386.c:6661
#4  0x00000000029a748c in ix86_function_arg_advance (cum_v={magic = 0x4a6f0a0, p = 0x7fffffffe090}, mode=BLKmode, type=0x7ffff77a9498, named=1 '\001') at ../../gcc/config/i386/i386.c:6715
#5  0x0000000000ea45dd in gimplify_parameters () at ../../gcc/function.c:3572
#6  0x00000000010217b5 in gimplify_body (fndecl=0x7ffff77c6100, do_parms=1 '\001') at ../../gcc/gimplify.c:8140
#7  0x0000000001022e0a in gimplify_function_tree (fndecl=0x7ffff77c6100) at ../../gcc/gimplify.c:8278
#8  0x0000000000a8a229 in cgraph_analyze_function (node=0x7ffff7697750) at ../../gcc/cgraphunit.c:608
#9  0x0000000000a8b472 in cgraph_analyze_functions () at ../../gcc/cgraphunit.c:901
#10 0x0000000000a901cf in cgraph_finalize_compilation_unit () at ../../gcc/cgraphunit.c:2416
#11 0x000000000050e4f4 in c_write_global_declarations () at ../../gcc/c-decl.c:10043
#12 0x0000000001985ba3 in compile_file () at ../../gcc/toplev.c:572
#13 0x0000000001987f7d in do_compile () at ../../gcc/toplev.c:1939
#14 0x00000000019880d2 in toplev_main (argc=3, argv=0x7fffffffe7c8) at ../../gcc/toplev.c:2015
#15 0x000000000074efbb in main (argc=3, argv=0x7fffffffe7c8) at ../../gcc/main.c:36

I guess the catch is that gimplify_body is the last one knowing what statement it is looking at.  I would expected expansion to set the source location, right?
Outputting this on functio ndeclaration, that is still avaiable to the cummulative arguments API is not quite right, because we would not handle indirect calls.

Honza
Comment 4 Jan Hubicka 2012-04-24 15:12:36 UTC
I guess get_curr_insn_source_location is what I neeed...
Comment 5 Jan Hubicka 2012-04-25 11:21:52 UTC
Hmm, after some playing with this, I don't really know how to make the warning output right all the time.  To fix the regression I will simply update the testcase.
The warning now goes on different place because of different gimplification order. We used to first gimplify the call. Now we first gimplify the function and warn on its declaration.
It is not bad and the input_location is correctly initialized by cgraph.

I do not get any confused carret:
a.c: In function 'foo1':
a.c:16:1: note: the ABI of passing union with long double has changed in GCC 4.4
 foo1 (union un u)
 ^
Comment 6 Jan Hubicka 2012-04-25 11:31:47 UTC
Author: hubicka
Date: Wed Apr 25 11:31:42 2012
New Revision: 186815

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=186815
Log:
	PR middle-end/53088
	* gcc.target/i386/pr39082-1.c: Update warning location.

Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.target/i386/pr39082-1.c
Comment 7 Richard Biener 2012-09-07 11:25:26 UTC
Fixed.