How to use a button as gpio input

I setup one pin as input mode, and connect it to the 3.3V.

I think the pin will give a high level and the gpio value will be 1. But when I connect it to 3.3V, the system restarts.

So how to setup, or something wrong?