Bug 67569 - wrong type in error message with float on x86 (387)
Summary: wrong type in error message with float on x86 (387)
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.8.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2015-09-14 09:38 UTC by BENAÏSSA
Modified: 2016-08-13 12:42 UTC (History)
1 user (show)

See Also:
Host:
Target: i?86-*-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed: 2016-08-13 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description BENAÏSSA 2015-09-14 09:38:37 UTC
/* Erroneous compiler error message */

 int main(void)
{
   int   *A = (int *)533 ;
   float  F = 1.F        ;
   A - F                 ;   
   return 0             ;
}

/*
   Results:
   In function 'main':
   main_comp_err_msg.c:6:5: 
   erreur: invalid operands to binary - (have 'int *' and 'long double')
       A-F;
         ^
   Note:
   The variable F is not of type long double.        

   Microsoft Windows XP Profesional version2002 Service Pack 3.
   Gcc 4.8.0 win32 mingw32 -std=C99 

*/
Comment 1 Marek Polacek 2015-09-14 10:21:57 UTC
Can't reproduce:

h1.c: In function ‘main’:
h1.c:5:6: error: invalid operands to binary - (have ‘int *’ and ‘float’)

Also, gcc 4.8 is not supported anymore.
Comment 2 Andrew Pinski 2015-09-14 12:27:47 UTC
Actually this might be reproducible with -m32 on x86_64. The issue is related to the fix for exessive precision.
Comment 3 Manuel López-Ibáñez 2015-09-14 13:01:12 UTC
(In reply to Andrew Pinski from comment #2)
> Actually this might be reproducible with -m32 on x86_64. The issue is
> related to the fix for exessive precision.

Yes, it is. With 6.0, cc1 -m32 -std=c99 on x86_64-linux-gnu.
Comment 4 BENAÏSSA 2015-09-14 13:27:53 UTC
Thank you for your replty.     A.Benaïssa
 


     Le Lundi 14 septembre 2015 11h22, mpolacek at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org> a écrit :
   

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

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

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

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Can't reproduce:

h1.c: In function ‘main’:
h1.c:5:6: error: invalid operands to binary - (have ‘int *’ and ‘float’)

Also, gcc 4.8 is not supported anymore.
Comment 5 BENAÏSSA 2015-09-14 13:29:18 UTC
Thank you.          A.Benaïssa
 


     Le Lundi 14 septembre 2015 13h27, pinskia at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org> a écrit :
   

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

          What    |Removed                    |Added
----------------------------------------------------------------------------
            Status|RESOLVED                    |UNCONFIRMED
        Resolution|WORKSFORME                  |---

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Actually this might be reproducible with -m32 on x86_64. The issue is related
to the fix for exessive precision.
Comment 6 Manuel López-Ibáñez 2016-08-13 12:42:19 UTC
Maybe instead of:

      binary_op_error (&richloc, code, TREE_TYPE (op0), TREE_TYPE (op1));

we should use

      binary_op_error (&richloc, code, orig_type0, orig_type1);

in c-typeck.c