From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32683 invoked by alias); 25 Mar 2017 14:05:41 -0000 Mailing-List: contact jit-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Subscribe: Sender: jit-owner@gcc.gnu.org Received: (qmail 32670 invoked by uid 89); 25 Mar 2017 14:05:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.99.2 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GARBLED_BODY,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy= X-Spam-Status: No, score=1.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GARBLED_BODY,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: * X-HELO: mail-yw0-f181.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=ixCsQuewxLrMwYMkyggquUTYMMkF+7XMv6oTxxLVhkw=; b=XlmrrQc00ruA1gHjwdwUHymIoGvCibzdZqW/+x0da3/73J0kRKv7dbxiobHDGN3htT uJUc4aS6X6y/NRPVyVh6BGYhSNNN44QZJ4LbYDaGEfFdoMYNjuUxmfEKXyyUq2KTZyu8 JIPQuInAH6Fek3o4MYDcKVtXTPPuvaNqe3M8xWCAcM4HmyTz8s3TBgvF6nwNqGN3ggEG c0QEPOAyqr/gZFncsnxw66/vKjDpWaCOy0j3doH2jN5cVRp/q3yMRTcRbi+Ya7+JwozS gLaktYnu6+UbMcigFMdSKmAOa+Dygrepm06ASyPlhndEYsehpHtKgx+sI30NflXCGfgj 4Hhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=ixCsQuewxLrMwYMkyggquUTYMMkF+7XMv6oTxxLVhkw=; b=PJHdUm+Hfn5JxkWRAZL8PbA7EOFtc9U1C/gPmM/ay/TnwGcKKcRi4Cyx9mbY4uxTCU HLNZxHzOWNrxuBybQSTvcLuhUrkw00poof7LeXJn7aymh4YyLvOvwzIuHDGO5+kUw6IW WCmH3zxqF1yCb9d6p3XEqD7nBz3RW+xI01cQmqnWFnGf2rT6UuegexLZ+cQIcYqaWVSx sulwLPxG+V5u4GaIeOXf4Xq3dptICLGhEq+bmtB6pHSKs/BaCxoDQr+dwfeCv8WPlWcs PtnTNrJPF4Szt/rKETwhS9CmwKL20pVCmcaXGFKlBcfT7xY4FTZ88v5JQSqT+oNmFcxu YPtQ== X-Gm-Message-State: AFeK/H0ZhlgRtqcc0YqZ2X0ltnl3Q3bvy/gJTHwiYXwBBGTJ+lNRxrAAqPDGU3EAlr8/HNd1Vbu+Y5+adpHlUg== X-Received: by 10.37.65.7 with SMTP id o7mr9876083yba.70.1490450738765; Sat, 25 Mar 2017 07:05:38 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <87fui1pj74.fsf@mid.deneb.enyo.de> References: <87fui1pj74.fsf@mid.deneb.enyo.de> From: =?UTF-8?B?7KCV7J2467CwKEluYmFlIEplb25nKQ==?= Date: Sun, 01 Jan 2017 00:00:00 -0000 Message-ID: Subject: Re: Alignment not supported? To: Florian Weimer Cc: jit@gcc.gnu.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2017-q1/txt/msg00010.txt.bz2 Sorry for being too short. It's JIT mailing list so I thought everyone would expect it to be related to gccjit. I'm writing a small JITed interpreter and trying to call an external C function (actually it is an external "C" C++ function) of which one of the parameters is a struct containing an aligned member variable. To make a struct type with gccjit, it will be somewhat like this: struct my_arg { int a; alignas(32) int b; }; 1: gcc_jit_type *int_type =3D gcc_jit_context_get_type(ctxt, GCC_JIT_TYPE_= INT) 2: gcc_jit_field *field_a =3D gcc_jit_context_new_field(ctxt, NULL, int_type, "a"); 3: gcc_jit_field *field_b =3D gcc_jit_context_new_field(ctxt, NULL, int_type, "b"); // How do I specify the alignment? 4: gcc_jit_field *fields[2] =3D {field_a, field_b}; 5: gcc_jit_struct *my_arg =3D gcc_jit_context_new_struct_type(ctxt, NULL, "my_arg", 2, fields); Maybe the alignment should be specified in line 3 or a new int type has to be made with alignment specification, if supported. However I don't see anything about alignment in the gccjit manual. 2017-03-25 22:41 GMT+09:00 Florian Weimer : > * =EC=A0=95=EC=9D=B8=EB=B0=B0: > >> I need to align a type for calling an external function. >> >> How do I set the alignment for a type like the struct below? >> >> struct my_arg { >> int a; >> alignas(32) int b; >> }; >> >> I don't see any option for giving the alignment requirement to b. > > This should work: > > struct my_arg { > int a; > int b __attribute__ ((aligned (32))); > };