Quantcast

Default argument constructor with brace initialized array miscompilation

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Default argument constructor with brace initialized array miscompilation

Lang Hames via cfe-dev
https://godbolt.org/g/sm5tMo

For code below there are missing destructor calls - make_a() is called 5 times but ~A() only once.

struct A {
    ~A();
};
A make_a();
struct B {
    B(A a = make_a()) {};
};

int main() {
    B b[5] = {};
}
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Default argument constructor with brace initialized array miscompilation

Lang Hames via cfe-dev
On 29 April 2017 at 15:32, Adam Nowacki via cfe-dev
<[hidden email]> wrote:
> https://godbolt.org/g/sm5tMo
>
> For code below there are missing destructor calls - make_a() is called 5 times but ~A() only once.

Interesting, thanks for telling us about it. It certainly looks dodgy
to me so I've created a bug report: http://llvm.org/PR33040. Not
really my area, but I'll try to actually take a look at it today.

Tim.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Default argument constructor with brace initialized array miscompilation

Lang Hames via cfe-dev
This was already filed as PR22877; I fixed it last week.

On 15 May 2017 8:07 am, "Tim Northover via cfe-dev" <[hidden email]> wrote:
On 29 April 2017 at 15:32, Adam Nowacki via cfe-dev
<[hidden email]> wrote:
> https://godbolt.org/g/sm5tMo
>
> For code below there are missing destructor calls - make_a() is called 5 times but ~A() only once.

Interesting, thanks for telling us about it. It certainly looks dodgy
to me so I've created a bug report: http://llvm.org/PR33040. Not
really my area, but I'll try to actually take a look at it today.

Tim.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Default argument constructor with brace initialized array miscompilation

Lang Hames via cfe-dev
On 15 May 2017 at 09:01, Richard Smith <[hidden email]> wrote:
> This was already filed as PR22877; I fixed it last week.

Oh bother, thanks. I thought I'd checked it against today's trunk but
it seems my build directory had gone wonky and I was only building
LLVM.

Tim.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Loading...