public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/67840] New: #define function error
@ 2015-10-04 14:57 ka_bena at yahoo dot fr
  2015-10-04 15:26 ` [Bug c/67840] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: ka_bena at yahoo dot fr @ 2015-10-04 14:57 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 67840
           Summary: #define function error
           Product: gcc
           Version: 4.8.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ka_bena at yahoo dot fr
  Target Milestone: ---

/* #define function error */

#include <stdio.h>
#include <math.h>
#include <quadmath.h>

#define tadjib(x) (sizeof( x )== sizeof( float )       ?cosf(x) \
                  :sizeof( x )== sizeof( double )      ?cos(x)  \
                  :sizeof( x ) == sizeof( long double )?cosl(x) \
                  :cosq(x))

 int main(void)
{ 
   float       x = tadjib(1.F) ;
   double      y = tadjib(1. ) ;
   long double z = tadjib(1.L) ;

   printf("%E  \n" , x ) ;
   printf("%E  \n" , y ) ;
   printf("%LE \n" , z ) ;

   printf("\n");

   float       x1 = 1.F ;
   double      y1 = 1.  ;
   long double z1 = 1.L ;

   printf ( "%E  \n" , tadjib(x1) ) ;
   printf ( "%E  \n" , tadjib(y1) ) ;
   printf ( "%LE \n" , tadjib(z1) ) ;

   return 0 ;
}
/*
main_test_generic.c: In function ‘main’:
main_test_generic.c:29:4: warning: format ‘%E’ expects argument of type
‘double’, but argument 2 has type ‘__float128’ [-Wformat=]
    printf ( "%E  \n" , tadjib(x1) ) ;
    ^
main_test_generic.c:30:4: warning: format ‘%E’ expects argument of type
‘double’, but argument 2 has type ‘__float128’ [-Wformat=]
    printf ( "%E  \n" , tadjib(y1) ) ;
    ^
main_test_generic.c:31:4: warning: format ‘%LE’ expects argument of type ‘long
double’, but argument 2 has type ‘__float128’ [-Wformat=]
    printf ( "%LE \n" , tadjib(z1) ) ;
    ^

Done.*/

/* Results:: 
   main_test_generic.exe

   5.403023E-01  
   5.403023E-01  
   5.403023E-01 

   -5.610234E-259  
   5.403023E-01  
   5.403023E-01 

   gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04)
   gcc -std=gnu99 -omain_test_generic.exe main_test_generic.c -lm  -lquadmath ;
*/
>From gcc-bugs-return-498713-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Oct 04 14:57:20 2015
Return-Path: <gcc-bugs-return-498713-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 104432 invoked by alias); 4 Oct 2015 14:57:20 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 104379 invoked by uid 48); 4 Oct 2015 14:57:16 -0000
From: "ubizjak at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/66697] Feature request: -mstackrealign and force_align_arg_pointer for x86_64
Date: Sun, 04 Oct 2015 14:57:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: enhancement
X-Bugzilla-Who: ubizjak at gmail dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-66697-4-lpUFq1uLdD@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-66697-4@http.gcc.gnu.org/bugzilla/>
References: <bug-66697-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-10/txt/msg00268.txt.bz2
Content-length: 2477

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

--- Comment #2 from Uroš Bizjak <ubizjak at gmail dot com> ---
IMO, if "outside" code misaligns stack, then these applications need support
for -mincoming-stack-boundary=3, which is currently limited on x86_64 to 4.

Documentation says:

'-mincoming-stack-boundary=NUM'
     Assume the incoming stack is aligned to a 2 raised to NUM byte
     boundary.  If '-mincoming-stack-boundary' is not specified, the one
     specified by '-mpreferred-stack-boundary' is used.

     [...]

Following patch:

--cut here--
Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c  (revision 228460)
+++ config/i386/i386.c  (working copy)
@@ -5102,8 +5102,7 @@ ix86_option_override_internal (bool main_args_p,
   ix86_incoming_stack_boundary = ix86_default_incoming_stack_boundary;
   if (opts_set->x_ix86_incoming_stack_boundary_arg)
     {
-      int min = (TARGET_64BIT_P (opts->x_ix86_isa_flags)
-                ? (TARGET_SSE_P (opts->x_ix86_isa_flags) ? 4 : 3) : 2);
+      int min = TARGET_64BIT_P (opts->x_ix86_isa_flags) ? 3 : 2;

       if (opts->x_ix86_incoming_stack_boundary_arg < min
          || opts->x_ix86_incoming_stack_boundary_arg > 12)
--cut here--

will compile following test:

-- cut here--
typedef float v4sf __attribute__((vector_size(16)));

v4sf test (v4sf a, v4sf b)
{
  volatile v4sf z = a + b;
  return z;
}
--cut here--

using "-O2 -mincoming-stack-boundary=3" to:

0000000000000000 <test>:
   0:   4c 8d 54 24 08          lea    0x8(%rsp),%r10
   5:   0f 58 c8                addps  %xmm0,%xmm1
   8:   48 83 e4 f0             and    $0xfffffffffffffff0,%rsp
   c:   41 ff 72 f8             pushq  -0x8(%r10)
  10:   55                      push   %rbp
  11:   48 89 e5                mov    %rsp,%rbp
  14:   41 52                   push   %r10
  16:   0f 29 4d e0             movaps %xmm1,-0x20(%rbp)
  1a:   0f 28 45 e0             movaps -0x20(%rbp),%xmm0
  1e:   41 5a                   pop    %r10
  20:   5d                      pop    %rbp
  21:   49 8d 62 f8             lea    -0x8(%r10),%rsp
  25:   c3                      retq   

The stack realignment code ensures ABI-compliant stack alignment in all
functions - and is kind of punishment for rogue application.
>From gcc-bugs-return-498715-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Oct 04 15:10:07 2015
Return-Path: <gcc-bugs-return-498715-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 126670 invoked by alias); 4 Oct 2015 15:10:06 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 126448 invoked by uid 48); 4 Oct 2015 15:10:02 -0000
From: "charlet at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ada/67837] Ada ATC with delay abort syscalls not working
Date: Sun, 04 Oct 2015 15:10:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: ada
X-Bugzilla-Version: 5.2.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: charlet at gcc dot gnu.org
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Resolution: INVALID
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status cc resolution
Message-ID: <bug-67837-4-yLr9DgMtIo@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-67837-4@http.gcc.gnu.org/bugzilla/>
References: <bug-67837-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-10/txt/msg00270.txt.bz2
Content-length: 702

https://gcc.gnu.org/bugzilla/show_bug.cgi?idg837

Arnaud Charlet <charlet at gcc dot gnu.org> changed:

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

--- Comment #1 from Arnaud Charlet <charlet at gcc dot gnu.org> ---
Actually Ada does not make any guarantee when mixing ATC and system calls and
indeed, it is fundamentally unsafe if not impossible to properly abort from any
random system call, so this isn't supported.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c/67840] #define function error
  2015-10-04 14:57 [Bug c/67840] New: #define function error ka_bena at yahoo dot fr
@ 2015-10-04 15:26 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-10-04 15:26 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
For ?: both sides are converted into a single type which in case is __float128.
 There is _Generic or the other builtin which does not suffer this issue.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-04 15:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-04 14:57 [Bug c/67840] New: #define function error ka_bena at yahoo dot fr
2015-10-04 15:26 ` [Bug c/67840] " pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).