diff mbox series

[v3,01/17] gcc PR 88409: miscompilation due to missing cc clobber in longlong.h macros

Message ID 20200306182419.13945-2-vgupta@synopsys.com
State New
Headers show
Series glibc port to ARC processors | expand

Commit Message

Vineet Gupta March 6, 2020, 6:24 p.m. UTC
simple test such as below was failing.

| void main(int argc, char *argv[])
| {
|    size_t total_time = 115424;                       // expected 115.424
|    double secs = (double)total_time/(double)1000;
|    printf("%s %d %lf\n", "secs", total_time, secs);  // prints 113.504
|    printf("%d\n", (size_t)secs);
| }

The printf eventually called into glibc stdlib/divrem.c:__mpn_divrem()
which uses the __arc__ specific inline asm macros from longlong.h which
were causing miscompilation.

include/
2019-03-28  Vineet Gupta <vgupta@synopsys.com>

	PR 89877

	* longlong.h [__arc__] (add_ssaaaa): Add cc clobber
	(sub_ddmmss): Likewise.

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
---
 stdlib/longlong.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Joseph Myers March 7, 2020, 12:12 a.m. UTC | #1
If this gets longlong.h back in sync with changes made in the GCC version, 
then please commit.
Vineet Gupta March 7, 2020, 12:21 a.m. UTC | #2
On 3/6/20 4:12 PM, Joseph Myers wrote:
> If this gets longlong.h back in sync with changes made in the GCC version, 
> then please commit.

Yes it does. The only differences now are in the initial licensing header due to
glibc's variant bumping year and the http -> https.

BTW, I don't think I asked for commit access before. I just rechecked MAINTAINERS
wiki page and seems like someone needs to grant me that.

Thx for taking a look.

-Vineet
Alexander Cherepanov March 9, 2020, 3:23 p.m. UTC | #3
On 06/03/2020 21.24, Vineet Gupta wrote:
> simple test such as below was failing.
> 
> | void main(int argc, char *argv[])
> | {
> |    size_t total_time = 115424;                       // expected 115.424
> |    double secs = (double)total_time/(double)1000;
> |    printf("%s %d %lf\n", "secs", total_time, secs);  // prints 113.504
> |    printf("%d\n", (size_t)secs);
> | }
> 
> The printf eventually called into glibc stdlib/divrem.c:__mpn_divrem()
> which uses the __arc__ specific inline asm macros from longlong.h which
> were causing miscompilation.
> 
> include/
> 2019-03-28  Vineet Gupta <vgupta@synopsys.com>
> 
> 	PR 89877
> 
> 	* longlong.h [__arc__] (add_ssaaaa): Add cc clobber
> 	(sub_ddmmss): Likewise.
Is PR number in subject (88409) wrong? The one in Changelog (89877) 
seems to be right.
Vineet Gupta March 9, 2020, 11:38 p.m. UTC | #4
On 3/9/20 8:23 AM, Alexander Cherepanov wrote:
>>
>>     PR 89877
>>
>>     * longlong.h [__arc__] (add_ssaaaa): Add cc clobber
>>     (sub_ddmmss): Likewise.
>
> Is PR number in subject (88409) wrong? The one in Changelog (89877) seems to be
> right.

Yes you are right. I'll fix this up.

Thx,
-Vineet
Bae, Chang Seok via Libc-alpha March 10, 2020, 5:23 p.m. UTC | #5
On 3/6/20 4:21 PM, Vineet Gupta wrote:
>
> BTW, I don't think I asked for commit access before. I just rechecked MAINTAINERS
> wiki page and seems like someone needs to grant me that.

Hi Joseph, Carlos

I'm trying to setup my sourceware account etc and the form below [1] needs "email
address of person who approved request". Whats the typical procedure for getting
that ?

Thx,
-Vineet

[1] https://sourceware.org/cgi-bin/pdw/ps_form.cgi
Bae, Chang Seok via Libc-alpha March 10, 2020, 5:57 p.m. UTC | #6
On 3/10/20 1:23 PM, Vineet Gupta wrote:
> On 3/6/20 4:21 PM, Vineet Gupta wrote:
>>
>> BTW, I don't think I asked for commit access before. I just rechecked MAINTAINERS
>> wiki page and seems like someone needs to grant me that.
> 
> Hi Joseph, Carlos
> 
> I'm trying to setup my sourceware account etc and the form below [1] needs "email
> address of person who approved request". Whats the typical procedure for getting
> that ?

Please take a look at the following page:

"Becoming a maintainer (developer)":
https://sourceware.org/glibc/wiki/MAINTAINERS#Becoming_a_maintainer_.28developer.29
~~~
5. Ask for commit access.

    * Ask one of the project stewards to authorize your commit access.

    * If the project steward authorizes you for commit access follow these 
      instructions to create a sourceware account with commit access to the
      glibc repository. 
~~~

Joseph and I are both stewards.
"Project stewards (GNU package maintainers)"
https://sourceware.org/glibc/wiki/MAINTAINERS#Project_stewards_.28GNU_package_maintainers.29

I would be happy to authorize your commit access.

I assume your intent is to be one of the machine maintainers for ARC?

> Thx,
> -Vineet
> 
> [1] https://sourceware.org/cgi-bin/pdw/ps_form.cgi
>
Bae, Chang Seok via Libc-alpha March 10, 2020, 6:08 p.m. UTC | #7
On 3/10/20 10:57 AM, Carlos O'Donell via Libc-alpha wrote:
> Please take a look at the following page:
> 
> "Becoming a maintainer (developer)":
> https://sourceware.org/glibc/wiki/MAINTAINERS#Becoming_a_maintainer_.28developer.29
> ~~~
> 5. Ask for commit access.
> 
>     * Ask one of the project stewards to authorize your commit access.
> 
>     * If the project steward authorizes you for commit access follow these 
>       instructions to create a sourceware account with commit access to the
>       glibc repository. 
> ~~~
> 
> Joseph and I are both stewards.
> "Project stewards (GNU package maintainers)"
> https://sourceware.org/glibc/wiki/MAINTAINERS#Project_stewards_.28GNU_package_maintainers.29
> 
> I would be happy to authorize your commit access.
> 
> I assume your intent is to be one of the machine maintainers for ARC?

Yeah, this email was my indirect way of asking for commit access :-)
Indeed this is for ARC glibc machine maintainer.

Thx,
-Vineet
Bae, Chang Seok via Libc-alpha March 10, 2020, 6:10 p.m. UTC | #8
On 3/10/20 2:08 PM, Vineet Gupta wrote:
> On 3/10/20 10:57 AM, Carlos O'Donell via Libc-alpha wrote:
>> Please take a look at the following page:
>>
>> "Becoming a maintainer (developer)":
>> https://sourceware.org/glibc/wiki/MAINTAINERS#Becoming_a_maintainer_.28developer.29
>> ~~~
>> 5. Ask for commit access.
>>
>>     * Ask one of the project stewards to authorize your commit access.
>>
>>     * If the project steward authorizes you for commit access follow these 
>>       instructions to create a sourceware account with commit access to the
>>       glibc repository. 
>> ~~~
>>
>> Joseph and I are both stewards.
>> "Project stewards (GNU package maintainers)"
>> https://sourceware.org/glibc/wiki/MAINTAINERS#Project_stewards_.28GNU_package_maintainers.29
>>
>> I would be happy to authorize your commit access.
>>
>> I assume your intent is to be one of the machine maintainers for ARC?
> 
> Yeah, this email was my indirect way of asking for commit access :-)
> Indeed this is for ARC glibc machine maintainer.

Please submit the request then and include my email.
Bae, Chang Seok via Libc-alpha March 11, 2020, 2 a.m. UTC | #9
On 3/6/20 4:12 PM, Joseph Myers wrote:
> If this gets longlong.h back in sync with changes made in the GCC version, 
> then please commit.

This is now committed (my first commit yay !)

Thx,
-Vineet
diff mbox series

Patch

diff --git a/stdlib/longlong.h b/stdlib/longlong.h
index ee4aac1bb5a0..638b7894d48c 100644
--- a/stdlib/longlong.h
+++ b/stdlib/longlong.h
@@ -199,7 +199,8 @@  extern UDItype __udiv_qrnnd (UDItype *, UDItype, UDItype, UDItype);
 	   : "%r" ((USItype) (ah)),					\
 	     "rICal" ((USItype) (bh)),					\
 	     "%r" ((USItype) (al)),					\
-	     "rICal" ((USItype) (bl)))
+	     "rICal" ((USItype) (bl))					\
+	   : "cc")
 #define sub_ddmmss(sh, sl, ah, al, bh, bl) \
   __asm__ ("sub.f	%1, %4, %5\n\tsbc	%0, %2, %3"		\
 	   : "=r" ((USItype) (sh)),					\
@@ -207,7 +208,8 @@  extern UDItype __udiv_qrnnd (UDItype *, UDItype, UDItype, UDItype);
 	   : "r" ((USItype) (ah)),					\
 	     "rICal" ((USItype) (bh)),					\
 	     "r" ((USItype) (al)),					\
-	     "rICal" ((USItype) (bl)))
+	     "rICal" ((USItype) (bl))					\
+	   : "cc")
 
 #define __umulsidi3(u,v) ((UDItype)(USItype)u*(USItype)v)
 #ifdef __ARC_NORM__